diff --git a/security/tor/src/opnsense/mvc/app/controllers/OPNsense/Tor/forms/hidden_service.xml b/security/tor/src/opnsense/mvc/app/controllers/OPNsense/Tor/forms/hidden_service.xml
index b1827ad43..5b2900614 100644
--- a/security/tor/src/opnsense/mvc/app/controllers/OPNsense/Tor/forms/hidden_service.xml
+++ b/security/tor/src/opnsense/mvc/app/controllers/OPNsense/Tor/forms/hidden_service.xml
@@ -11,4 +11,18 @@
textEnter a directory name for the hidden service. It may consist of lowercase and uppercase characters.
+
+ hiddenservice.type
+
+ dropdown
+ The type can either be 'Basic' for a general-purpose authorization protocol or 'Stealth' for a less scalable protocol that also hides service activity from unauthorized clients.
+
+
+ hiddenservice.clients
+
+ select_multiple
+
+ true
+ If configured, only clients that are listed here are authorized to access the hidden service.
+
diff --git a/security/tor/src/opnsense/mvc/app/models/OPNsense/Tor/HiddenService.xml b/security/tor/src/opnsense/mvc/app/models/OPNsense/Tor/HiddenService.xml
index cda02738e..01d47e089 100644
--- a/security/tor/src/opnsense/mvc/app/models/OPNsense/Tor/HiddenService.xml
+++ b/security/tor/src/opnsense/mvc/app/models/OPNsense/Tor/HiddenService.xml
@@ -1,6 +1,7 @@
//OPNsense/tor/hiddenserviceTor hidden service configuration
+ 1.0.0
@@ -9,9 +10,23 @@
Y
- /^[a-z0-9_-]+$/i
- The name should only consist of alphanumeric characters, dashes and underscores.
+ /^[a-z0-9_-]+$/i
+ The name should only consist of alphanumeric characters, dashes and underscores.
+
+ basic
+ Y
+
+ Basic
+ Stealth
+
+
+
+ Y
+ N
+ /^([a-z0-9_+-]+,)*([a-z0-9_+-]*)$/i
+ The authorized clients should only consist of alphanumeric characters, dashes, underscores and plus sign.
+
diff --git a/security/tor/src/opnsense/service/templates/OPNsense/Tor/torrc b/security/tor/src/opnsense/service/templates/OPNsense/Tor/torrc
index 6e55f4c6d..5a0d5619f 100644
--- a/security/tor/src/opnsense/service/templates/OPNsense/Tor/torrc
+++ b/security/tor/src/opnsense/service/templates/OPNsense/Tor/torrc
@@ -86,6 +86,9 @@ AutomapHostsOnResolve {{ OPNsense.tor.general.dns_map_hosts }}
{% if helpers.exists('OPNsense.tor.hiddenservice.service') %}
{% for service in helpers.toList('OPNsense.tor.hiddenservice.service') %}
HiddenServiceDir /var/db/tor/{{ service.name }}/
+{% if (service.clients is defined) and service.clients %}
+HiddenServiceAuthorizeClient {{ service.type }} {{ service.clients }}
+{% endif %}
{% for acl in helpers.toList('OPNsense.tor.hiddenserviceacl.hiddenserviceacl') %}
{% if helpers.getUUID(acl.hiddenservice).name == service.name %}
HiddenServicePort {{ acl.port}} {{ acl.target_host }}:{{ acl.target_port }}