diff --git a/dns/unbound-plus/Makefile b/dns/unbound-plus/Makefile index 919cc3b51..0e296dd61 100644 --- a/dns/unbound-plus/Makefile +++ b/dns/unbound-plus/Makefile @@ -1,5 +1,5 @@ PLUGIN_NAME= unbound-plus -PLUGIN_VERSION= 0.1 +PLUGIN_VERSION= 0.2 PLUGIN_COMMENT= Unbound additions PLUGIN_MAINTAINER= m.muenz@gmail.com PLUGIN_DEVEL= yes diff --git a/dns/unbound-plus/src/opnsense/mvc/app/controllers/OPNsense/Unboundplus/Api/ServiceController.php b/dns/unbound-plus/src/opnsense/mvc/app/controllers/OPNsense/Unboundplus/Api/ServiceController.php index 20975a79f..9983e2843 100644 --- a/dns/unbound-plus/src/opnsense/mvc/app/controllers/OPNsense/Unboundplus/Api/ServiceController.php +++ b/dns/unbound-plus/src/opnsense/mvc/app/controllers/OPNsense/Unboundplus/Api/ServiceController.php @@ -44,6 +44,7 @@ class ServiceController extends ApiMutableServiceControllerBase $this->sessionClose(); $mdl = new Dnsbl(); $backend = new Backend(); + $backend->configdRun('template reload OPNsense/Unboundplus'); $response = $backend->configdpRun('unboundplus dnsbl', array((string)$mdl->type)); return array("response" => $response); } diff --git a/dns/unbound-plus/src/opnsense/mvc/app/controllers/OPNsense/Unboundplus/forms/dnsbl.xml b/dns/unbound-plus/src/opnsense/mvc/app/controllers/OPNsense/Unboundplus/forms/dnsbl.xml index abd7cc647..10eb50a93 100644 --- a/dns/unbound-plus/src/opnsense/mvc/app/controllers/OPNsense/Unboundplus/forms/dnsbl.xml +++ b/dns/unbound-plus/src/opnsense/mvc/app/controllers/OPNsense/Unboundplus/forms/dnsbl.xml @@ -11,4 +11,12 @@ select_multiple Select which kind of DNSBL you want to use. + + dnsbl.whitelists + + select_multiple + + true + List of domains to whitelist. + diff --git a/dns/unbound-plus/src/opnsense/mvc/app/models/OPNsense/Unboundplus/Dnsbl.xml b/dns/unbound-plus/src/opnsense/mvc/app/models/OPNsense/Unboundplus/Dnsbl.xml index 34df0c7b0..4073fac26 100644 --- a/dns/unbound-plus/src/opnsense/mvc/app/models/OPNsense/Unboundplus/Dnsbl.xml +++ b/dns/unbound-plus/src/opnsense/mvc/app/models/OPNsense/Unboundplus/Dnsbl.xml @@ -37,5 +37,8 @@ YoYo List + + N + diff --git a/dns/unbound-plus/src/opnsense/scripts/OPNsense/Unboundplus/dnsbl.sh b/dns/unbound-plus/src/opnsense/scripts/OPNsense/Unboundplus/dnsbl.sh index 91e9bee99..c2b0f83b9 100755 --- a/dns/unbound-plus/src/opnsense/scripts/OPNsense/Unboundplus/dnsbl.sh +++ b/dns/unbound-plus/src/opnsense/scripts/OPNsense/Unboundplus/dnsbl.sh @@ -213,7 +213,12 @@ simpletrack() { install() { # Put all files in correct format for FILE in $(find ${WORKDIR} -type f); do - cat ${FILE} | sort -u | awk '{printf "server:\n", $1; printf "local-data: \"%s A 0.0.0.0\"\n", $1}' > ${FILE}.inc + WHITE=$(cat ${DESTDIR}/whitelist.inc | tr ',' '|') + if [ -z "${WHITE}" ]; then + cat ${FILE} | sort -u | awk '{printf "server:\n", $1; printf "local-data: \"%s A 0.0.0.0\"\n", $1}' > ${FILE}.inc + else + cat ${FILE} | sort -u | egrep -v "$WHITE" | awk '{printf "server:\n", $1; printf "local-data: \"%s A 0.0.0.0\"\n", $1}' > ${FILE}.inc + fi done # Merge resulting files (/dev/null in case there are none) cat $(find ${WORKDIR} -type f -name "*.inc") /dev/null > ${DESTDIR}/dnsbl.conf diff --git a/dns/unbound-plus/src/opnsense/service/templates/OPNsense/Unboundplus/+TARGETS b/dns/unbound-plus/src/opnsense/service/templates/OPNsense/Unboundplus/+TARGETS index 66ba5a14b..115f95f26 100644 --- a/dns/unbound-plus/src/opnsense/service/templates/OPNsense/Unboundplus/+TARGETS +++ b/dns/unbound-plus/src/opnsense/service/templates/OPNsense/Unboundplus/+TARGETS @@ -1 +1,2 @@ dnsbl.inc:/var/unbound/etc/dnsbl.inc +whitelist.inc:/var/unbound/etc/whitelist.inc diff --git a/dns/unbound-plus/src/opnsense/service/templates/OPNsense/Unboundplus/dnsbl.inc b/dns/unbound-plus/src/opnsense/service/templates/OPNsense/Unboundplus/dnsbl.inc index 34a0b0dbd..a47edf32f 100644 --- a/dns/unbound-plus/src/opnsense/service/templates/OPNsense/Unboundplus/dnsbl.inc +++ b/dns/unbound-plus/src/opnsense/service/templates/OPNsense/Unboundplus/dnsbl.inc @@ -1,5 +1,5 @@ -{% if helpers.exists('OPNsense.unbound.dnsbl.enabled') and OPNsense.unbound.dnsbl.enabled == '1' %} -{% if helpers.exists('OPNsense.unbound.dnsbl.type') and OPNsense.unbound.dnsbl.type != '' %} -unbound_dnsbl="{{ OPNsense.unbound.dnsbl.type }}" +{% if helpers.exists('OPNsense.unboundplus.dnsbl.enabled') and OPNsense.unboundplus.dnsbl.enabled == '1' %} +{% if helpers.exists('OPNsense.unboundplus.dnsbl.type') and OPNsense.unboundplus.dnsbl.type != '' %} +unbound_dnsbl="{{ OPNsense.unboundplus.dnsbl.type }}" {% endif %} {% endif %} diff --git a/dns/unbound-plus/src/opnsense/service/templates/OPNsense/Unboundplus/whitelist.inc b/dns/unbound-plus/src/opnsense/service/templates/OPNsense/Unboundplus/whitelist.inc new file mode 100644 index 000000000..473b3824f --- /dev/null +++ b/dns/unbound-plus/src/opnsense/service/templates/OPNsense/Unboundplus/whitelist.inc @@ -0,0 +1,7 @@ +{% if helpers.exists('OPNsense.unboundplus.dnsbl.enabled') and OPNsense.unboundplus.dnsbl.enabled == '1' %} +{% if helpers.exists('OPNsense.unboundplus.dnsbl.type') and OPNsense.unboundplus.dnsbl.type != '' %} +{% if helpers.exists('OPNsense.unboundplus.dnsbl.whitelists') and OPNsense.unboundplus.dnsbl.whitelists != '' %} +{{ OPNsense.unboundplus.dnsbl.whitelists|default("") }} +{% endif %} +{% endif %} +{% endif %}