improve DNS test output
This commit is contained in:
parent
2bbb7a5e7e
commit
fff06f7d71
1 changed files with 11 additions and 2 deletions
|
@ -51,7 +51,7 @@ def test2(tests, server, description):
|
||||||
response = dns.resolver.query(qname, rtype)
|
response = dns.resolver.query(qname, rtype)
|
||||||
except dns.resolver.NXDOMAIN:
|
except dns.resolver.NXDOMAIN:
|
||||||
# host did not have an answer for this query
|
# host did not have an answer for this query
|
||||||
response = ["NOT SET"]
|
response = ["[no value]"]
|
||||||
response = ";".join(str(r) for r in response)
|
response = ";".join(str(r) for r in response)
|
||||||
response = re.sub(r"(\"p=).*(\")", r"\1__KEY__\2", response) # normalize DKIM key
|
response = re.sub(r"(\"p=).*(\")", r"\1__KEY__\2", response) # normalize DKIM key
|
||||||
|
|
||||||
|
@ -64,9 +64,10 @@ def test2(tests, server, description):
|
||||||
if first:
|
if first:
|
||||||
print("Incorrect DNS Response from", description)
|
print("Incorrect DNS Response from", description)
|
||||||
print()
|
print()
|
||||||
|
print("QUERY ", "RESPONSE ", "CORRECT VALUE", sep='\t')
|
||||||
first = False
|
first = False
|
||||||
|
|
||||||
print(qname, rtype, "got", repr(response), "but we should have gotten", repr(expected_answer))
|
print((qname + "/" + rtype).ljust(20), response.ljust(12), expected_answer, sep='\t')
|
||||||
return first # success
|
return first # success
|
||||||
|
|
||||||
# Test the response from the machine itself.
|
# Test the response from the machine itself.
|
||||||
|
@ -75,6 +76,9 @@ if not test(ipaddr, "Mail-in-a-Box"):
|
||||||
print ("Please run the Mail-in-a-Box setup script on %s again." % hostname)
|
print ("Please run the Mail-in-a-Box setup script on %s again." % hostname)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
|
print ("The Mail-in-a-Box provided correct DNS answers.")
|
||||||
|
print ()
|
||||||
|
|
||||||
# If those settings are OK, also test Google's Public DNS
|
# If those settings are OK, also test Google's Public DNS
|
||||||
# to see if the machine is hooked up to recursive DNS properly.
|
# to see if the machine is hooked up to recursive DNS properly.
|
||||||
if not test("8.8.8.8", "Google Public DNS"):
|
if not test("8.8.8.8", "Google Public DNS"):
|
||||||
|
@ -82,10 +86,15 @@ else:
|
||||||
print ("Check that the nameserver settings for %s are correct at your domain registrar. It may take a few hours for Google Public DNS to update after changes on your Mail-in-a-Box." % hostname)
|
print ("Check that the nameserver settings for %s are correct at your domain registrar. It may take a few hours for Google Public DNS to update after changes on your Mail-in-a-Box." % hostname)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
|
print ("Your domain registrar or DNS host appears to be configured correctly as well. Public DNS provides the same answers.")
|
||||||
|
print ()
|
||||||
|
|
||||||
# And if that's OK, also check reverse DNS (the PTR record).
|
# And if that's OK, also check reverse DNS (the PTR record).
|
||||||
if not test_ptr("8.8.8.8", "Google Public DNS (Reverse DNS)"):
|
if not test_ptr("8.8.8.8", "Google Public DNS (Reverse DNS)"):
|
||||||
print ()
|
print ()
|
||||||
print ("The reverse DNS for %s is not correct. Consult your ISP for how to set the reverse DNS (also called the PTR record) for %s to %s." % (hostname, hostname, ipaddr))
|
print ("The reverse DNS for %s is not correct. Consult your ISP for how to set the reverse DNS (also called the PTR record) for %s to %s." % (hostname, hostname, ipaddr))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
|
print ("And the reverse DNS for the domain is correct.")
|
||||||
|
print ()
|
||||||
print ("DNS is OK.")
|
print ("DNS is OK.")
|
||||||
|
|
Loading…
Reference in a new issue