From 84638ab11e7e793b01bf1452c67a5dffe7daf6ea Mon Sep 17 00:00:00 2001 From: "Robert G. Jakabosky" Date: Sun, 20 Mar 2016 08:19:59 +0800 Subject: [PATCH 1/2] Fix creation of custom MX records. --- management/dns_update.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/management/dns_update.py b/management/dns_update.py index 6f4de318..957e8290 100755 --- a/management/dns_update.py +++ b/management/dns_update.py @@ -175,9 +175,6 @@ def build_zone(domain, all_domains, additional_records, www_redirect_domains, en for value in build_sshfp_records(): records.append((None, "SSHFP", value, "Optional. Provides an out-of-band method for verifying an SSH key before connecting. Use 'VerifyHostKeyDNS yes' (or 'VerifyHostKeyDNS ask') when connecting with ssh.")) - # The MX record says where email for the domain should be delivered: Here! - records.append((None, "MX", "10 %s." % env["PRIMARY_HOSTNAME"], "Required. Specifies the hostname (and priority) of the machine that handles @%s mail." % domain)) - # Add DNS records for any subdomains of this domain. We should not have a zone for # both a domain and one of its subdomains. subdomains = [d for d in all_domains if d.endswith("." + domain)] @@ -244,6 +241,10 @@ def build_zone(domain, all_domains, additional_records, www_redirect_domains, en # Don't pin the list of records that has_rec checks against anymore. has_rec_base = records + # The MX record says where email for the domain should be delivered: Here! + if not has_rec(None, "MX"): + records.append((None, "MX", "10 %s." % env["PRIMARY_HOSTNAME"], "Required. Specifies the hostname (and priority) of the machine that handles @%s mail." % domain)) + # SPF record: Permit the box ('mx', see above) to send mail on behalf of # the domain, and no one else. # Skip if the user has set a custom SPF record. From 72fcb005b208f18577e2bff52ce34531ee95d249 Mon Sep 17 00:00:00 2001 From: "Robert G. Jakabosky" Date: Tue, 22 Mar 2016 03:07:14 +0800 Subject: [PATCH 2/2] Check MX priority. --- management/dns_update.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/management/dns_update.py b/management/dns_update.py index 957e8290..836ad0d4 100755 --- a/management/dns_update.py +++ b/management/dns_update.py @@ -242,7 +242,7 @@ def build_zone(domain, all_domains, additional_records, www_redirect_domains, en has_rec_base = records # The MX record says where email for the domain should be delivered: Here! - if not has_rec(None, "MX"): + if not has_rec(None, "MX", prefix="10 "): records.append((None, "MX", "10 %s." % env["PRIMARY_HOSTNAME"], "Required. Specifies the hostname (and priority) of the machine that handles @%s mail." % domain)) # SPF record: Permit the box ('mx', see above) to send mail on behalf of