From c403895f95f6c36a11b1c2891ac64bf343ddac15 Mon Sep 17 00:00:00 2001 From: Joshua Tauberer Date: Sat, 10 May 2014 07:15:31 -0400 Subject: [PATCH] test_dns: properly test the non-primary domain of a box (for email addresses on domains besides PUBLIC_HOSTNAME) --- tests/test_dns.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/test_dns.py b/tests/test_dns.py index cb7aa0f..1f4e7b2 100755 --- a/tests/test_dns.py +++ b/tests/test_dns.py @@ -11,19 +11,22 @@ import sys, re, difflib import dns.reversename, dns.resolver if len(sys.argv) < 3: - print("Usage: tests/dns.py ipaddress hostname") + print("Usage: tests/dns.py ipaddress hostname [primary hostname]") sys.exit(1) -ipaddr, hostname = sys.argv[1:] +ipaddr, hostname = sys.argv[1:3] +primary_hostname = hostname +if len(sys.argv) == 4: + primary_hostname = sys.argv[3] def test(server, description): tests = [ (hostname, "A", ipaddr), - (hostname, "NS", "ns1.%s.;ns2.%s." % (hostname, hostname)), - ("ns1." + hostname, "A", ipaddr), - ("ns2." + hostname, "A", ipaddr), + (hostname, "NS", "ns1.%s.;ns2.%s." % (primary_hostname, primary_hostname)), + ("ns1." + primary_hostname, "A", ipaddr), + ("ns2." + primary_hostname, "A", ipaddr), ("www." + hostname, "A", ipaddr), - (hostname, "MX", "10 " + hostname + "."), + (hostname, "MX", "10 " + primary_hostname + "."), (hostname, "TXT", "\"v=spf1 mx -all\""), ("mail._domainkey." + hostname, "TXT", "\"v=DKIM1; k=rsa; s=email; \" \"p=__KEY__\""), ]