diff --git a/dns/bind/src/opnsense/mvc/app/controllers/OPNsense/Bind/forms/dialogEditBindDomain.xml b/dns/bind/src/opnsense/mvc/app/controllers/OPNsense/Bind/forms/dialogEditBindDomain.xml index eed6958bb..c7ccbfbb7 100644 --- a/dns/bind/src/opnsense/mvc/app/controllers/OPNsense/Bind/forms/dialogEditBindDomain.xml +++ b/dns/bind/src/opnsense/mvc/app/controllers/OPNsense/Bind/forms/dialogEditBindDomain.xml @@ -46,13 +46,19 @@ domain.transferkeyalgo dropdown - Set the authentication algorithm for the TSIG key. + Set the authentication algorithm for the TSIG key used to transfer domain data from the master server. + + + domain.transferkeyname + + text + The name of the TSIG key, which must match the value on the master server. domain.transferkey text - The TSIG key used to transfer domain data from the master server. + The base64-encoded TSIG key. domain.allownotifyslave diff --git a/dns/bind/src/opnsense/mvc/app/models/OPNsense/Bind/Domain.xml b/dns/bind/src/opnsense/mvc/app/models/OPNsense/Bind/Domain.xml index 2ddbcf003..c33f41c97 100644 --- a/dns/bind/src/opnsense/mvc/app/models/OPNsense/Bind/Domain.xml +++ b/dns/bind/src/opnsense/mvc/app/models/OPNsense/Bind/Domain.xml @@ -33,6 +33,10 @@ HMAC-MD5 + + N + + N diff --git a/dns/bind/src/opnsense/mvc/app/views/OPNsense/Bind/general.volt b/dns/bind/src/opnsense/mvc/app/views/OPNsense/Bind/general.volt index 47a705350..13e9fb12a 100644 --- a/dns/bind/src/opnsense/mvc/app/views/OPNsense/Bind/general.volt +++ b/dns/bind/src/opnsense/mvc/app/views/OPNsense/Bind/general.volt @@ -277,9 +277,9 @@ $( document ).ready(function() { $('#domain\\.transferkeyalgo').on('change', function(e) { if (e.target.selectedIndex === 0) { - $('#domain\\.transferkey').val('').attr('readonly', true); + $('#domain\\.transferkey,#domain\\.transferkeyname').val('').attr('readonly', true); } else { - $('#domain\\.transferkey').attr('readonly', false); + $('#domain\\.transferkey,#domain\\.transferkeyname').attr('readonly', false); } }); 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 d0c552157..94fd79aac 100644 --- a/dns/bind/src/opnsense/service/templates/OPNsense/Bind/named.conf +++ b/dns/bind/src/opnsense/service/templates/OPNsense/Bind/named.conf @@ -131,6 +131,7 @@ zone "rpzbing" { type master; file "/usr/local/etc/namedb/master/bing.db"; notif {% endif %} {% if helpers.exists('OPNsense.bind.domain.domains.domain') %} +{% set usedkeys = [] %} {% for domain in helpers.toList('OPNsense.bind.domain.domains.domain') %} {% if domain.enabled == '1' %} {% set allow_transfer = helpers.getUUID(domain.allowtransfer) %} @@ -138,7 +139,11 @@ zone "rpzbing" { type master; file "/usr/local/etc/namedb/master/bing.db"; notif zone "{{ domain.domainname }}" { type {{ domain.type }}; {% if domain.type == 'slave' %} +{% if domain.transferkey is defined %} + masters { {{ domain.masterip.replace(',', ' key "' ~ domain.transferkeyname ~ '"; ') }} key "{{ domain.transferkeyname }}"; }; +{% else %} masters { {{ domain.masterip.replace(',', '; ') }}; }; +{% endif %} {% if domain.allownotifyslave is defined %} allow-notify { {{ domain.allownotifyslave.replace(',', '; ') }}; }; {% endif %} @@ -153,15 +158,12 @@ zone "{{ domain.domainname }}" { allow-query { {{ allow_query.name }}; }; {% endif %} }; -{% if domain.type == 'slave' and domain.transferkey is defined %} -{% set key_name = 'tsig-transferkey-' ~ domain.domainname.replace('.', '-') %} -key "{{ key_name }}" { +{% if domain.type == 'slave' and domain.transferkey is defined and not(domain.transferkeyname in usedkeys) %} +{% do usedkeys.append(domain.transferkeyname) %} +key "{{ domain.transferkeyname }}" { algorithm "{{ domain.transferkeyalgo }}"; secret "{{ domain.transferkey }}"; }; -server {{ domain.masterip }} { - keys { "{{ key_name }}" }; -}; {% endif %} {% endif %} {% endfor %}