Allow secondary DNS xfr: items to be hostnames that are resolved to IP addresses when generating the nsd configuration
This commit is contained in:
parent
0ee0784bde
commit
e828d63a85
|
@ -12,6 +12,7 @@ Control panel:
|
||||||
|
|
||||||
* Control panel pages can be opened in a new tab/window and bookmarked and browser history navigation now works.
|
* Control panel pages can be opened in a new tab/window and bookmarked and browser history navigation now works.
|
||||||
* Add a Copy button to put the rsync backup public key on clipboard.
|
* Add a Copy button to put the rsync backup public key on clipboard.
|
||||||
|
* Allow secondary DNS xfr: items added in the control panel to be hostnames too.
|
||||||
* Fixed issue where sshkeygen fails when IPv6 is disabled.
|
* Fixed issue where sshkeygen fails when IPv6 is disabled.
|
||||||
* Fixed issue opening munin reports.
|
* Fixed issue opening munin reports.
|
||||||
* Fixed report formatting in status emails sent to the administrator.
|
* Fixed report formatting in status emails sent to the administrator.
|
||||||
|
|
|
@ -1005,32 +1005,33 @@ def get_secondary_dns(custom_dns, mode=None):
|
||||||
values.append(hostname)
|
values.append(hostname)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# This is a hostname. Before including in zone xfr lines,
|
# If the entry starts with "xfr:" only include it in the zone transfer settings.
|
||||||
# resolve to an IP address. Otherwise just return the hostname.
|
if hostname.startswith("xfr:"):
|
||||||
|
if mode != "xfr": continue
|
||||||
|
hostname = hostname[4:]
|
||||||
|
|
||||||
|
# If is a hostname, before including in zone xfr lines,
|
||||||
|
# resolve to an IP address.
|
||||||
# It may not resolve to IPv6, so don't throw an exception if it
|
# It may not resolve to IPv6, so don't throw an exception if it
|
||||||
# doesn't.
|
# doesn't. Skip the entry if there is a DNS error.
|
||||||
if not hostname.startswith("xfr:"):
|
|
||||||
if mode == "xfr":
|
if mode == "xfr":
|
||||||
try:
|
try:
|
||||||
response = resolver.resolve(hostname+'.', "A", raise_on_no_answer=False)
|
ipaddress.ip_interface(hostname) # test if it's an IP address or CIDR notation
|
||||||
values.extend(map(str, response))
|
|
||||||
except dns.exception.DNSException:
|
|
||||||
pass
|
|
||||||
|
|
||||||
try:
|
|
||||||
response = resolver.resolve(hostname+'.', "AAAA", raise_on_no_answer=False)
|
|
||||||
values.extend(map(str, response))
|
|
||||||
except dns.exception.DNSException:
|
|
||||||
pass
|
|
||||||
continue
|
|
||||||
values.append(hostname)
|
values.append(hostname)
|
||||||
|
except ValueError:
|
||||||
|
try:
|
||||||
|
response = dns.resolver.resolve(hostname+'.', "A", raise_on_no_answer=False)
|
||||||
|
values.extend(map(str, response))
|
||||||
|
except dns.exception.DNSException:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
response = dns.resolver.resolve(hostname+'.', "AAAA", raise_on_no_answer=False)
|
||||||
|
values.extend(map(str, response))
|
||||||
|
except dns.exception.DNSException:
|
||||||
|
pass
|
||||||
|
|
||||||
# This is a zone-xfer-only IP address. Do not return if
|
else:
|
||||||
# we're querying for NS record hostnames. Only return if
|
values.append(hostname)
|
||||||
# we're querying for zone xfer IP addresses - return the
|
|
||||||
# IP address.
|
|
||||||
elif mode == "xfr":
|
|
||||||
values.append(hostname[4:])
|
|
||||||
|
|
||||||
return values
|
return values
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@
|
||||||
<div class="col-sm-offset-1 col-sm-11">
|
<div class="col-sm-offset-1 col-sm-11">
|
||||||
<p class="small">
|
<p class="small">
|
||||||
Multiple secondary servers can be separated with commas or spaces (i.e., <code>ns2.hostingcompany.com ns3.hostingcompany.com</code>).
|
Multiple secondary servers can be separated with commas or spaces (i.e., <code>ns2.hostingcompany.com ns3.hostingcompany.com</code>).
|
||||||
To enable zone transfers to additional servers without listing them as secondary nameservers, add an IP address or subnet using <code>xfr:10.20.30.40</code> or <code>xfr:10.0.0.0/8</code>.
|
To enable zone transfers to additional servers without listing them as secondary nameservers, prefix a hostname, IP address, or subnet with <code>xfr:</code>, e.g. <code>xfr:10.20.30.40</code> or <code>xfr:10.0.0.0/8</code>.
|
||||||
</p>
|
</p>
|
||||||
<p id="secondarydns-clear-instructions" style="display: none" class="small">
|
<p id="secondarydns-clear-instructions" style="display: none" class="small">
|
||||||
Clear the input field above and click Update to use this machine itself as secondary DNS, which is the default/normal setup.
|
Clear the input field above and click Update to use this machine itself as secondary DNS, which is the default/normal setup.
|
||||||
|
|
Loading…
Reference in New Issue