From 3edd472aaa007a9f080c3f9d863d4c774114f1b5 Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Sun, 16 Oct 2022 18:31:02 +0200 Subject: [PATCH] Services: Unbound DNS - remove 127/8 from private-address block when rebind protection is enabled as advised by unbound (https://unbound.docs.nlnetlabs.nl/en/latest/manpages/unbound.conf.html#term-private-address-IP-address-or-subnet) and make the default items configurable via the advanced page. closes https://github.com/opnsense/core/issues/5871 --- src/etc/inc/plugins.inc.d/unbound.inc | 38 ++++--------------- .../OPNsense/Unbound/forms/advanced.xml | 15 ++++++++ .../app/models/OPNsense/Unbound/Unbound.xml | 9 ++++- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/etc/inc/plugins.inc.d/unbound.inc b/src/etc/inc/plugins.inc.d/unbound.inc index 9dbdab3dc..92fd73dac 100644 --- a/src/etc/inc/plugins.inc.d/unbound.inc +++ b/src/etc/inc/plugins.inc.d/unbound.inc @@ -149,36 +149,14 @@ function unbound_generate_config() $module_config .= 'python iterator'; } + $private_addr = ""; if (!isset($config['system']['webgui']['nodnsrebindcheck'])) { - $private_addr = << + + unbound.advanced.privateaddress + + select_multiple + + true + + These are addresses on your private network, and are not allowed to be returned for public internet names. + Any occurrence of such addresses are removed from DNS answers. + Additionally, the DNSSEC validator may mark the answers bogus. + This protects against so-called DNS Rebinding. + + (Only applicable when DNS rebind check is enabled in System->Settings->Administration) + + unbound.advanced.insecuredomain diff --git a/src/opnsense/mvc/app/models/OPNsense/Unbound/Unbound.xml b/src/opnsense/mvc/app/models/OPNsense/Unbound/Unbound.xml index 489301594..56c2228cc 100644 --- a/src/opnsense/mvc/app/models/OPNsense/Unbound/Unbound.xml +++ b/src/opnsense/mvc/app/models/OPNsense/Unbound/Unbound.xml @@ -1,7 +1,7 @@ //OPNsense/unboundplus Unbound configuration - 1.0.3 + 1.0.4 unbound.enable @@ -64,6 +64,13 @@ N + + N + , + N + 0.0.0.0/8,10.0.0.0/8,100.64.0.0/10,169.254.0.0/16,172.16.0.0/12,192.0.2.0/24,192.168.0.0/16,198.18.0.0/15,198.51.100.0/24,203.0.113.0/24,233.252.0.0/24,::1/128,2001:db8::/32,fc00::/8,fd00::/8,fe80::/10 + Y + N