diff --git a/plist b/plist index 55de2cc90..d79ff42c0 100644 --- a/plist +++ b/plist @@ -386,6 +386,7 @@ /usr/local/opnsense/mvc/app/controllers/OPNsense/TrafficShaper/forms/dialogPipe.xml /usr/local/opnsense/mvc/app/controllers/OPNsense/TrafficShaper/forms/dialogQueue.xml /usr/local/opnsense/mvc/app/controllers/OPNsense/TrafficShaper/forms/dialogRule.xml +/usr/local/opnsense/mvc/app/controllers/OPNsense/Unbound/AdvancedController.php /usr/local/opnsense/mvc/app/controllers/OPNsense/Unbound/Api/DiagnosticsController.php /usr/local/opnsense/mvc/app/controllers/OPNsense/Unbound/Api/ServiceController.php /usr/local/opnsense/mvc/app/controllers/OPNsense/Unbound/Api/SettingsController.php @@ -394,6 +395,7 @@ /usr/local/opnsense/mvc/app/controllers/OPNsense/Unbound/ForwardController.php /usr/local/opnsense/mvc/app/controllers/OPNsense/Unbound/OverridesController.php /usr/local/opnsense/mvc/app/controllers/OPNsense/Unbound/StatsController.php +/usr/local/opnsense/mvc/app/controllers/OPNsense/Unbound/forms/advanced.xml /usr/local/opnsense/mvc/app/controllers/OPNsense/Unbound/forms/dialogDomainOverride.xml /usr/local/opnsense/mvc/app/controllers/OPNsense/Unbound/forms/dialogDot.xml /usr/local/opnsense/mvc/app/controllers/OPNsense/Unbound/forms/dialogHostAlias.xml @@ -666,6 +668,7 @@ /usr/local/opnsense/mvc/app/views/OPNsense/Syslog/index.volt /usr/local/opnsense/mvc/app/views/OPNsense/TrafficShaper/index.volt /usr/local/opnsense/mvc/app/views/OPNsense/TrafficShaper/statistics.volt +/usr/local/opnsense/mvc/app/views/OPNsense/Unbound/advanced.volt /usr/local/opnsense/mvc/app/views/OPNsense/Unbound/dnsbl.volt /usr/local/opnsense/mvc/app/views/OPNsense/Unbound/dot.volt /usr/local/opnsense/mvc/app/views/OPNsense/Unbound/overrides.volt @@ -1057,6 +1060,7 @@ /usr/local/opnsense/service/templates/OPNsense/Syslog/syslog-ng-lockout.conf /usr/local/opnsense/service/templates/OPNsense/Syslog/syslog-ng.conf /usr/local/opnsense/service/templates/OPNsense/Unbound/core/+TARGETS +/usr/local/opnsense/service/templates/OPNsense/Unbound/core/advanced.conf /usr/local/opnsense/service/templates/OPNsense/Unbound/core/blocklists.conf /usr/local/opnsense/service/templates/OPNsense/Unbound/core/domainoverrides.conf /usr/local/opnsense/service/templates/OPNsense/Unbound/core/dot.conf diff --git a/src/etc/inc/plugins.inc.d/unbound.inc b/src/etc/inc/plugins.inc.d/unbound.inc index 871a04163..b25354415 100644 --- a/src/etc/inc/plugins.inc.d/unbound.inc +++ b/src/etc/inc/plugins.inc.d/unbound.inc @@ -313,6 +313,7 @@ pidfile: /var/run/unbound.pid root-hints: /var/unbound/root.hints use-syslog: yes port: {$port} +include: /var/unbound/advanced.conf verbosity: {$verbosity} extended-statistics: {$extended_statistics} log-queries: {$log_queries} diff --git a/src/opnsense/mvc/app/controllers/OPNsense/Unbound/AdvancedController.php b/src/opnsense/mvc/app/controllers/OPNsense/Unbound/AdvancedController.php new file mode 100755 index 000000000..e67b27552 --- /dev/null +++ b/src/opnsense/mvc/app/controllers/OPNsense/Unbound/AdvancedController.php @@ -0,0 +1,40 @@ +view->advancedForm = $this->getForm('advanced'); + $this->view->pick('OPNsense/Unbound/advanced'); + } +} diff --git a/src/opnsense/mvc/app/controllers/OPNsense/Unbound/forms/advanced.xml b/src/opnsense/mvc/app/controllers/OPNsense/Unbound/forms/advanced.xml new file mode 100755 index 000000000..274e29fee --- /dev/null +++ b/src/opnsense/mvc/app/controllers/OPNsense/Unbound/forms/advanced.xml @@ -0,0 +1,183 @@ +
+ + unbound.advanced.hideidentity + + checkbox + If enabled, id.server and hostname.bind queries are refused. + + + unbound.advanced.hideversion + + checkbox + If enabled, version.server and version.bind queries are refused. + + + unbound.advanced.prefetch + + checkbox + + Message cache elements are prefetched before they expire to help keep the cache up to date. + When enabled, this option can cause an increase of around 10% more DNS traffic and load + on the server, but frequently requested items will not expire from the cache. + + + + unbound.advanced.prefetchkey + + checkbox + + DNSKEYs are fetched earlier in the validation process when a Delegation signer is encountered. + This helps lower the latency of requests but does utilize a little more CPU. + + + + unbound.advanced.dnssecstripped + + checkbox + + DNSSEC data is required for trust-anchored zones. If such data is absent, the zone becomes bogus. + If this is disabled and no DNSSEC data is received, then the zone is made insecure. + + + + unbound.advanced.serveexpired + + checkbox + + Serve expired responses from the cache with a TTL of 0 without waiting for the actual resolution to finish. + + + + unbound.advanced.qnameinstrict + + checkbox + + Send minimum amount of information to upstream servers to enhance privacy. + Do not fall-back to sending full QNAME to potentially broken nameservers. + A lot of domains will not be resolvable when this option in enabled. + Only use if you know what you are doing. + + + + unbound.advanced.extendedstatistics + + checkbox + If enabled, extended statistics are printed. + + + unbound.advanced.logqueries + + checkbox + + If enabled, prints one line per query to the log, with the log timestamp and IP address, name, type and class. + + + + unbound.advanced.msgcachesize + + dropdown + + Size of the message cache. The message cache stores DNS rcodes and validation statuses. + The RRSet cache will automatically be set to twice this amount. The RRSet cache contains the actual RR data. + The default is 4 megabytes. + + + + unbound.advanced.outgoingnumtcp + + dropdown + + The number of outgoing TCP buffers to allocate per thread. The default value is 10. + If 0 is selected then no TCP queries, to authoritative servers, are done. + + + + unbound.advanced.incomingnumtcp + + dropdown + + The number of incoming TCP buffers to allocate per thread. The default value is 10. + If 0 is selected then no TCP queries, from clients, are accepted. + + + + unbound.advanced.numqueriesperthread + + dropdown + + The number of queries that every thread will service simultaneously. If more queries arrive that + need to be serviced, and no queries can be jostled, then these queries are dropped. + + + + unbound.advanced.jostletimeout + + dropdown + + This timeout is used for when the server is very busy. This protects against denial of service by + slow queries or high query rates. The default value is 200 milliseconds. + + + + unbound.advanced.cachemaxttl + + text + + Configure a maximum Time to live for RRsets and messages in the cache. + The default is 86400 seconds (1 day). When the internal TTL expires the cache item is expired. + This can be configured to force the resolver to query for data more often and + not trust (very large) TTL values. + + + + unbound.advanced.cacheminttl + + text + + Configure a minimum Time to live for RRsets and messages in the cache. + The default is 0 seconds. If the minimum value kicks in, the data is cached for longer than + the domain owner intended, and thus less queries are made to look up the data. + The 0 value ensures the data in the cache is as the domain owner intended. + High values can lead to trouble as the data in the cache might not match up with the actual data anymore. + + + + unbound.advanced.infrahostttl + + dropdown + + Time to live for entries in the host cache. The host cache contains roundtrip timing and EDNS + support information. The default is 15 minutes. + + + + unbound.advanced.infracachenumhosts + + dropdown + + Number of hosts for which information is cached. The default is 10000. + + + + unbound.advanced.unwantedreplythreshold + + dropdown + + If enabled, a total number of unwanted replies is kept track of in every thread. + When it reaches the threshold, a defensive action is taken and a warning is printed to the log file. + This defensive action is to clear the RRSet and message caches, hopefully flushing away any poison. + The default is disabled, but if enabled a value of 10 million is suggested. + + + + unbound.advanced.logverbosity + + dropdown + + Select the log verbosity. Level 0 means no verbosity, only errors. Level 1 gives operational information. + Level 2 gives detailed operational information. Level 3 gives query level information, output per query. + Level 4 gives algorithm level information. Level 5 logs client identification for cache misses. + Default is level 1. + + +
\ No newline at end of file diff --git a/src/opnsense/mvc/app/models/OPNsense/Unbound/ACL/ACL.xml b/src/opnsense/mvc/app/models/OPNsense/Unbound/ACL/ACL.xml index 21e92392e..27ca5d690 100644 --- a/src/opnsense/mvc/app/models/OPNsense/Unbound/ACL/ACL.xml +++ b/src/opnsense/mvc/app/models/OPNsense/Unbound/ACL/ACL.xml @@ -14,7 +14,8 @@ Services: Unbound DNS: Advanced - services_unbound_advanced.php* + ui/unbound/advanced/* + api/unbound/advanced/* diff --git a/src/opnsense/mvc/app/models/OPNsense/Unbound/Menu/Menu.xml b/src/opnsense/mvc/app/models/OPNsense/Unbound/Menu/Menu.xml index 6c4af6003..84f708975 100644 --- a/src/opnsense/mvc/app/models/OPNsense/Unbound/Menu/Menu.xml +++ b/src/opnsense/mvc/app/models/OPNsense/Unbound/Menu/Menu.xml @@ -3,7 +3,7 @@ - + diff --git a/src/opnsense/mvc/app/models/OPNsense/Unbound/Unbound.xml b/src/opnsense/mvc/app/models/OPNsense/Unbound/Unbound.xml index 992638a1b..1a9a62162 100644 --- a/src/opnsense/mvc/app/models/OPNsense/Unbound/Unbound.xml +++ b/src/opnsense/mvc/app/models/OPNsense/Unbound/Unbound.xml @@ -6,6 +6,155 @@ unbound.enable + + + 0 + N + + + 0 + N + + + 0 + N + + + 0 + N + + + 0 + N + + + 0 + N + + + 0 + N + + + 0 + N + + + 0 + N + + + N + opt1 + + 4 MB + 10 MB + 20 MB + 50 MB + 100 MB + 250 MB + 512 MB + + + + N + opt2 + + 0 + 10 + 20 + 30 + 40 + 50 + + + + N + opt2 + + 0 + 10 + 20 + 30 + 40 + 50 + + + + N + opt4 + + 512 + 1024 + 2048 + 4096 + 8192 + + + + N + opt2 + + 100 + 200 + 500 + 1000 + + + + N + 86400 + + + N + 0 + + + N + opt5 + + 1 minute + 2 minutes + 5 minutes + 10 minutes + 15 minutes + + + + N + opt3 + + 1000 + 5000 + 10000 + 20000 + 50000 + + + + N + Disabled + + 5 million + 10 million + 20 million + 40 million + 50 million + + + + N + opt2 + + Level 0 + Level 1 + Level 2 + Level 3 + Level 4 + Level 5 + + + 0 diff --git a/src/opnsense/mvc/app/views/OPNsense/Unbound/advanced.volt b/src/opnsense/mvc/app/views/OPNsense/Unbound/advanced.volt new file mode 100755 index 000000000..68c71bb75 --- /dev/null +++ b/src/opnsense/mvc/app/views/OPNsense/Unbound/advanced.volt @@ -0,0 +1,53 @@ +{# + # Copyright (c) 2022 Deciso B.V. + # All rights reserved. + # + # Redistribution and use in source and binary forms, with or without modification, + # are permitted provided that the following conditions are met: + # + # 1. Redistributions of source code must retain the above copyright notice, + # this list of conditions and the following disclaimer. + # + # 2. Redistributions in binary form must reproduce the above copyright notice, + # this list of conditions and the following disclaimer in the documentation + # and/or other materials provided with the distribution. + # + # THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + # AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + # AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + # OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + # POSSIBILITY OF SUCH DAMAGE. + #} + + + +
+{{ partial("layout_partials/base_form",['fields':advancedForm,'id':'frm_AdvancedSettings'])}} +
+
+ +
+
diff --git a/src/opnsense/service/templates/OPNsense/Unbound/core/+TARGETS b/src/opnsense/service/templates/OPNsense/Unbound/core/+TARGETS index d0234382e..8ed7bc632 100644 --- a/src/opnsense/service/templates/OPNsense/Unbound/core/+TARGETS +++ b/src/opnsense/service/templates/OPNsense/Unbound/core/+TARGETS @@ -1,3 +1,4 @@ +advanced.conf:/var/unbound/advanced.conf blocklists.conf:/tmp/unbound-blocklists.conf dot.conf:/usr/local/etc/unbound.opnsense.d/dot.conf private_domains.conf:/var/unbound/private_domains.conf diff --git a/src/opnsense/service/templates/OPNsense/Unbound/core/advanced.conf b/src/opnsense/service/templates/OPNsense/Unbound/core/advanced.conf new file mode 100755 index 000000000..e69de29bb