From 708d5e1a734636beca8886ec0df9d7ec674ae425 Mon Sep 17 00:00:00 2001 From: Sebastian Lohff Date: Tue, 2 May 2017 02:42:25 +0200 Subject: [PATCH] Fixed DNS api, works now with glue records + cleanup --- api/dnshelper.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/api/dnshelper.py b/api/dnshelper.py index ce9c378..56c0195 100644 --- a/api/dnshelper.py +++ b/api/dnshelper.py @@ -32,7 +32,6 @@ def compareRecords(rrset, expected): result["nameMissing"].append((domain, rrtype)) success = not any(len(_x) > 0 for _x in result.values()) - print("NARF", success, result) return success, result @@ -50,7 +49,6 @@ def dnsQuery(domain, rrType, nameserverIp): def checkDomain(domain, tldNameserver, nameservers): - print(domain, tldNameserver, nameservers) result = [] # build record set @@ -66,13 +64,10 @@ def checkDomain(domain, tldNameserver, nameservers): else: result.append(("err", "Nameserver %s is under domain %s, but has no glue entries." % (ns.name, domain))) - print(nsRecords, glueRecords) - # 1. TLD nameserver try: found, rrset = dnsQuery(domain, "ANY", tldNameserver) if found: - #print(rrset, nsRecords, glueRecords) success, errors = compareRecords(rrset, nsRecords + glueRecords) if success: result.append(("succ", "All records present in TLD nameserver")) @@ -109,7 +104,8 @@ def checkDomain(domain, tldNameserver, nameservers): for rec in (nsRecords + glueRecords): found, rrset = dnsQuery(rec[0], rec[1], addr) - success, errors = compareRecords(rrset, nsRecords + glueRecords) + #success, errors = compareRecords(rrset, nsRecords + glueRecords) + success, errors = compareRecords(rrset, [rec]) if not success: err = True for k in errors.keys(): @@ -118,8 +114,7 @@ def checkDomain(domain, tldNameserver, nameservers): if not err: result.append(("succ", "Nameserver %s is configured correctly" % ns.name)) else: - print(" ==> ", errDict, addr) - result.append(("err", "Nameserver %s recordset does not match the database" % (ns.name,), errDict)) + result.append(("err", "Nameserver %s (via %s) recordset does not match the database" % (ns.name, addr), errDict)) except (dns.exception.DNSException, OSError): result.append(("err", "Nameserver %s is not reachable (via %s)" % (ns.name, addr)))