diff --git a/www/squid/src/opnsense/mvc/app/controllers/OPNsense/Proxy/forms/main.xml b/www/squid/src/opnsense/mvc/app/controllers/OPNsense/Proxy/forms/main.xml index 309053bf1..8c01e6af7 100644 --- a/www/squid/src/opnsense/mvc/app/controllers/OPNsense/Proxy/forms/main.xml +++ b/www/squid/src/opnsense/mvc/app/controllers/OPNsense/Proxy/forms/main.xml @@ -421,6 +421,12 @@ Type IP addresses you want to deny access to the proxy server. true + + proxy.forward.acl.allowWhitelistBannedHosts + + checkbox + Allows banned hosts to access domains listed in whitelist. + proxy.forward.acl.whiteList diff --git a/www/squid/src/opnsense/mvc/app/models/OPNsense/Proxy/Proxy.xml b/www/squid/src/opnsense/mvc/app/models/OPNsense/Proxy/Proxy.xml index 9421f1ee3..4954eefff 100644 --- a/www/squid/src/opnsense/mvc/app/models/OPNsense/Proxy/Proxy.xml +++ b/www/squid/src/opnsense/mvc/app/models/OPNsense/Proxy/Proxy.xml @@ -355,6 +355,10 @@ /^([\/0-9a-fA-F.:,])*/u + + 1 + Y + diff --git a/www/squid/src/opnsense/service/templates/OPNsense/Proxy/squid.acl.conf b/www/squid/src/opnsense/service/templates/OPNsense/Proxy/squid.acl.conf index 16a07929d..b30258cb3 100644 --- a/www/squid/src/opnsense/service/templates/OPNsense/Proxy/squid.acl.conf +++ b/www/squid/src/opnsense/service/templates/OPNsense/Proxy/squid.acl.conf @@ -14,6 +14,20 @@ adaptation_access request_mod allow unrestricted http_access allow unrestricted {% endif %} +{% if helpers.exists('OPNsense.proxy.forward.acl.bannedHosts') and OPNsense.proxy.forward.acl.allowWhitelistBannedHosts|default('1') == '0' %} + +# ACL list (Deny) banned hosts +{% if helpers.exists('OPNsense.proxy.forward.icap.enable') and OPNsense.proxy.forward.icap.enable == '1' %} +{% if helpers.exists('OPNsense.proxy.forward.icap.ResponseURL') %} +adaptation_access response_mod deny bannedHosts +{% endif %} +{% if helpers.exists('OPNsense.proxy.forward.icap.RequestURL') %} +adaptation_access request_mod deny bannedHosts +{% endif %} +{% endif %} +http_access deny bannedHosts +{% endif %} + {% if helpers.exists('OPNsense.proxy.forward.acl.whiteList') %} # ACL list (Allow) whitelist @@ -139,7 +153,9 @@ adaptation_access request_mod deny CONNECT !SSL_ports {% if helpers.exists('OPNs http_access deny CONNECT !SSL_ports {% if helpers.exists('OPNsense.proxy.forward.acl.unrestricted') %}!unrestricted{% endif %} -{% if helpers.exists('OPNsense.proxy.forward.acl.bannedHosts') %} +{% if helpers.exists('OPNsense.proxy.forward.acl.bannedHosts') and OPNsense.proxy.forward.acl.allowWhitelistBannedHosts|default('1') == '1' %} + +# ACL list (Deny) banned hosts {% if helpers.exists('OPNsense.proxy.forward.icap.enable') and OPNsense.proxy.forward.icap.enable == '1' %} {% if helpers.exists('OPNsense.proxy.forward.icap.ResponseURL') %} adaptation_access response_mod deny bannedHosts