fix: make nameservers configurable
This commit is contained in:
parent
108850bad0
commit
e4735b197e
2 changed files with 4 additions and 4 deletions
|
|
@ -4,5 +4,6 @@ DB_PORT=3306
|
||||||
DB_USER=test
|
DB_USER=test
|
||||||
DB_PASS=testpass
|
DB_PASS=testpass
|
||||||
DB_DB=pdns
|
DB_DB=pdns
|
||||||
|
NAMESERVERS=localhost:10053
|
||||||
DNS_MASTER=wile
|
DNS_MASTER=wile
|
||||||
LOG_LEVEL=DEBUG
|
LOG_LEVEL=DEBUG
|
||||||
|
|
|
||||||
7
main.py
7
main.py
|
|
@ -25,19 +25,18 @@ def main():
|
||||||
# try to resolve dnskey.{zone} on all nameservers
|
# try to resolve dnskey.{zone} on all nameservers
|
||||||
# dammit, my testserver is running on a weird port
|
# dammit, my testserver is running on a weird port
|
||||||
r = dns.resolver.Resolver()
|
r = dns.resolver.Resolver()
|
||||||
nsarr = ['127.0.0.1:10053']
|
ns_str = config('NAMESERVERS', 'localhost:10053')
|
||||||
|
nsarr = ns_str.split(',')
|
||||||
expected = None
|
expected = None
|
||||||
for ns in nsarr:
|
for ns in nsarr:
|
||||||
# r.nameservers = [ns]
|
|
||||||
try:
|
try:
|
||||||
answer = r.resolve(qname=zone, rdtype='DNSKEY', tcp=False, search=ns)
|
answer = r.resolve(qname=zone, rdtype='DNSKEY', tcp=False, search=ns)
|
||||||
print(f"{answer=}")
|
|
||||||
if not expected:
|
if not expected:
|
||||||
expected = answer.rrset.to_text()
|
expected = answer.rrset.to_text()
|
||||||
# print(f"set {expected=}")
|
# print(f"set {expected=}")
|
||||||
else:
|
else:
|
||||||
if answer.rrset.to_text() != expected:
|
if answer.rrset.to_text() != expected:
|
||||||
print(f"{answer.rrset.to_text()=} differs from {expected=}")
|
logging.debug(f"{answer.rrset.to_text()=} differs from {expected=}")
|
||||||
# I'm very confident this is more complicated than it needs to be...
|
# I'm very confident this is more complicated than it needs to be...
|
||||||
db.query(f"""SELECT id,content FROM records WHERE type='SOA' AND name='{zone}'""")
|
db.query(f"""SELECT id,content FROM records WHERE type='SOA' AND name='{zone}'""")
|
||||||
result = db.store_result()
|
result = db.store_result()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue