Skip to content

Commit

Permalink
use IPv6 DNS Servers
Browse files Browse the repository at this point in the history
if a domain has 2 public nameservers, lets say ns0.domain.example
and ns1.domain.example, the hook now requests A and AAAA records for NS entries.
These are saved to a list
  [
   [ 'IPv4#1 of ns1',  'IPv4#2 of ns1', 'IPv6#1 of ns1'],
   [ 'IPv4#1 of ns2',  'IPv4#2 of ns2', 'IPv6#1 of ns2'],
  ]
When checking the TXT-record dnspython can check any IP of this server.
  • Loading branch information
Farom committed Jun 21, 2018
1 parent cedf2e6 commit 701b7a2
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions dehydrated-hook-ddns-tsig.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,13 @@ def query_NS_record(domain_name):
for i in range(0, len(name_list)):
nameservers = []
try:
for ns in [rdata.target.to_unicode()
for rdata in dns.resolver.query('.'.join(name_list[i:]),
'NS')]:
nameservers += [_.to_text() for _ in dns.resolver.query(ns)]
fqdn = '.'.join(name_list[i:])
for rdata in dns.resolver.query(fqdn, dns.rdatatype.NS):
ns = rdata.target.to_unicode()
nsL = []
nsL.extend([_.to_text() for _ in dns.resolver.query(ns)]) # default type: A
nsL.extend([_.to_text() for _ in dns.resolver.query(ns, rdtype=dns.rdatatype.AAAA)])
nameservers.append(nsL)
except (dns.resolver.NoAnswer, dns.resolver.NXDOMAIN) as e:
continue
if nameservers:
Expand Down Expand Up @@ -197,7 +200,7 @@ def verify_record(domain_name,
rtype,
rdata if rdata is not None else "*",
ns))
resolver.nameservers = [ns]
resolver.nameservers = ns
answer = []
try:
answer = [_.to_text().strip('"'+"'")
Expand Down

0 comments on commit 701b7a2

Please sign in to comment.