mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2024-11-24 02:37:05 +00:00
an mx record may be missing if the A record matches the A record of PRIMARY_HOSTNAME
This commit is contained in:
parent
28e254fb84
commit
65fb65ada7
@ -158,17 +158,35 @@ def check_dns_zone(domain, env, dns_zonefiles):
|
|||||||
print("")
|
print("")
|
||||||
|
|
||||||
def check_mail_domain(domain, env):
|
def check_mail_domain(domain, env):
|
||||||
# Check the MX record. A missing MX record is okay on the primary hostname
|
# Check the MX record.
|
||||||
# because the primary hostname's A record (the MX fallback) is... itself,
|
|
||||||
# which s what we want the MX to be.
|
|
||||||
mx = query_dns(domain, "MX", nxdomain=None)
|
mx = query_dns(domain, "MX", nxdomain=None)
|
||||||
expected_mx = "10 " + env['PRIMARY_HOSTNAME']
|
expected_mx = "10 " + env['PRIMARY_HOSTNAME']
|
||||||
|
|
||||||
if mx == expected_mx:
|
if mx == expected_mx:
|
||||||
print_ok("Domain's email is directed to this domain. [%s => %s]" % (domain, mx))
|
print_ok("Domain's email is directed to this domain. [%s => %s]" % (domain, mx))
|
||||||
elif mx == None and domain == env['PRIMARY_HOSTNAME']:
|
|
||||||
print_ok("Domain's email is directed to this domain. [%s has no MX record, which is ok]" % (domain,))
|
elif mx == None:
|
||||||
|
# A missing MX record is okay on the primary hostname because
|
||||||
|
# the primary hostname's A record (the MX fallback) is... itself,
|
||||||
|
# which is what we want the MX to be.
|
||||||
|
if domain == env['PRIMARY_HOSTNAME']:
|
||||||
|
print_ok("Domain's email is directed to this domain. [%s has no MX record, which is ok]" % (domain,))
|
||||||
|
|
||||||
|
# And a missing MX record is okay on other domains if the A record
|
||||||
|
# matches the A record of the PRIMARY_HOSTNAME. Actually this will
|
||||||
|
# probably confuse DANE TLSA, but we'll let that slide for now.
|
||||||
|
else:
|
||||||
|
domain_a = query_dns(domain, "A", nxdomain=None)
|
||||||
|
primary_a = query_dns(env['PRIMARY_HOSTNAME'], "A", nxdomain=None)
|
||||||
|
if domain_a != None and domain_a == primary_a:
|
||||||
|
print_ok("Domain's email is directed to this domain. [%s has no MX record but its A record is OK]" % (domain,))
|
||||||
|
else:
|
||||||
|
print_error("""This domain's DNS MX record is not set. It should be '%s'. Mail will not
|
||||||
|
be delivered to this box. It may take several hours for public DNS to update after a
|
||||||
|
change. This problem may result from other issues listed here.""" % (expected_mx,))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if mx == None: mx = "[Not Set]"
|
|
||||||
print_error("""This domain's DNS MX record is incorrect. It is currently set to '%s' but should be '%s'. Mail will not
|
print_error("""This domain's DNS MX record is incorrect. It is currently set to '%s' but should be '%s'. Mail will not
|
||||||
be delivered to this box. It may take several hours for public DNS to update after a change. This problem may result from
|
be delivered to this box. It may take several hours for public DNS to update after a change. This problem may result from
|
||||||
other issues listed here.""" % (mx, expected_mx))
|
other issues listed here.""" % (mx, expected_mx))
|
||||||
|
Loading…
Reference in New Issue
Block a user