From 1f37fe2013014e771a3a45be87c4a36c34e98791 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 19 Dec 2018 17:01:07 +0100 Subject: [PATCH] dns/bind: add some small options (#1079) --- dns/bind/pkg-descr | 2 + .../OPNsense/Bind/forms/general.xml | 37 +++++++++++++++++++ .../mvc/app/models/OPNsense/Bind/General.xml | 26 ++++++++++++- .../templates/OPNsense/Bind/named.conf | 19 ++++++++-- 4 files changed, 80 insertions(+), 4 deletions(-) diff --git a/dns/bind/pkg-descr b/dns/bind/pkg-descr index 1ae6feb44..976c2bf11 100644 --- a/dns/bind/pkg-descr +++ b/dns/bind/pkg-descr @@ -12,6 +12,8 @@ Plugin Changelog * Add Bing Strict Search * Add 4 new blacklists to DNSBL +* Ability to hide system hostname and version +* Rate-Limiting support 1.3 diff --git a/dns/bind/src/opnsense/mvc/app/controllers/OPNsense/Bind/forms/general.xml b/dns/bind/src/opnsense/mvc/app/controllers/OPNsense/Bind/forms/general.xml index a1658cedb..3a7db5343 100644 --- a/dns/bind/src/opnsense/mvc/app/controllers/OPNsense/Bind/forms/general.xml +++ b/dns/bind/src/opnsense/mvc/app/controllers/OPNsense/Bind/forms/general.xml @@ -59,4 +59,41 @@ dropdown Default is "No". Set to "Auto" to use the static trust anchor configuration by the system. + + general.hidehostname + + checkbox + true + This will hide the system hostname for DNS queries. + + + general.hideversion + + checkbox + true + This will hide the local BIND version in DNS queries. + + + general.enableratelimiting + + checkbox + true + This will enable rate-limiting for DNS replies. + + + general.ratelimitcount + + text + true + Set how many replies per second are allowed. + + + general.ratelimitexcept + + + select_multiple + true + true + Except a list of IPs from rate-limiting like ::1 + diff --git a/dns/bind/src/opnsense/mvc/app/models/OPNsense/Bind/General.xml b/dns/bind/src/opnsense/mvc/app/models/OPNsense/Bind/General.xml index 006bac894..5edbb8abf 100644 --- a/dns/bind/src/opnsense/mvc/app/models/OPNsense/Bind/General.xml +++ b/dns/bind/src/opnsense/mvc/app/models/OPNsense/Bind/General.xml @@ -1,7 +1,7 @@ //OPNsense/bind/general BIND configuration - 1.0.4 + 1.0.5 0 @@ -67,5 +67,29 @@ N Y + + 0 + Y + + + 0 + Y + + + 0 + Y + + + N + 1 + 1000 + Choose a value between 1 and 1000. + + + 127.0.0.1,::1 + , + Y + Y + diff --git a/dns/bind/src/opnsense/service/templates/OPNsense/Bind/named.conf b/dns/bind/src/opnsense/service/templates/OPNsense/Bind/named.conf index f231ab46a..0555fc6a8 100644 --- a/dns/bind/src/opnsense/service/templates/OPNsense/Bind/named.conf +++ b/dns/bind/src/opnsense/service/templates/OPNsense/Bind/named.conf @@ -38,15 +38,28 @@ options { {% endfor %} {% endif %} - {% if helpers.exists('OPNsense.bind.general.maxcachesize') and OPNsense.bind.general.maxcachesize != '' %} max-cache-size {{ OPNsense.bind.general.maxcachesize }}%; {% endif %} - {% if helpers.exists('OPNsense.bind.general.dnssecvalidation') and OPNsense.bind.general.dnssecvalidation != '' %} dnssec-validation {{ OPNsense.bind.general.dnssecvalidation }}; {% endif %} - +{% if helpers.exists('OPNsense.bind.general.hidehostname') and OPNsense.bind.general.hidehostname == '1' %} + hostname none; +{% endif %} +{% if helpers.exists('OPNsense.bind.general.hideversion') and OPNsense.bind.general.hideversion == '1' %} + version none; +{% endif %} +{% if helpers.exists('OPNsense.bind.general.enableratelimiting') and OPNsense.bind.general.enableratelimiting == '1' %} +{% if helpers.exists('OPNsense.bind.general.ratelimitcount') and OPNsense.bind.general.ratelimitcount != '' %} + rate-limit { + responses-per-second {{ OPNsense.bind.general.ratelimitcount }}; +{% if helpers.exists('OPNsense.bind.general.ratelimitexcept') and OPNsense.bind.general.ratelimitexcept != '' %} + exempt-clients { {{ OPNsense.bind.general.ratelimitexcept.replace(',', '; ') }}; }; +{% endif %} + }; +{% endif %} +{% endif %} }; key "rndc-key" {