From cb11b01f472363b8140013047600d97a86dca56b Mon Sep 17 00:00:00 2001 From: Joshua Tauberer Date: Sat, 17 Jan 2015 15:00:16 +0000 Subject: [PATCH] if a custom CNAME record is set, don't add a default A/AAAA record, e.g. for 'www' see https://discourse.mailinabox.email/t/multiple-domains-in-mail-in-a-box-with-the-domains-being-hosted-elsewhere/56/18 --- CHANGELOG.md | 3 ++- management/dns_update.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b1f7a15..bd727f51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,9 @@ CHANGELOG Development ----------- -Misc: +DNS: +* If a custom CNAME record is set, don't add a default A/AAAA record, e.g. for 'www', which end up preventing the CNAME record from working. * Support for internationalized domain names is added, but not well tested. Email login is with the IDNA (xn--) form of the domain. v0.06 (January 4, 2015) diff --git a/management/dns_update.py b/management/dns_update.py index 7c01f6df..cb0eb86b 100755 --- a/management/dns_update.py +++ b/management/dns_update.py @@ -212,6 +212,7 @@ def build_zone(domain, all_domains, additional_records, env, is_zone=True): records.append((qname, rtype, value, "(Set by user.)")) # Add defaults if not overridden by the user's custom settings (and not otherwise configured). + # Any "CNAME" record on the qname overrides A and AAAA. defaults = [ (None, "A", env["PUBLIC_IP"], "Required. May have a different value. Sets the IP address that %s resolves to for web hosting and other services besides mail. The A record must be present but its value does not affect mail delivery." % domain), ("www", "A", env["PUBLIC_IP"], "Optional. Sets the IP address that www.%s resolves to, e.g. for web hosting." % domain), @@ -221,7 +222,7 @@ def build_zone(domain, all_domains, additional_records, env, is_zone=True): for qname, rtype, value, explanation in defaults: if value is None or value.strip() == "": continue # skip IPV6 if not set if not is_zone and qname == "www": continue # don't create any default 'www' subdomains on what are themselves subdomains - if not has_rec(qname, rtype): + if not has_rec(qname, rtype) and not has_rec(qname, "CNAME"): records.append((qname, rtype, value, explanation)) # Append the DKIM TXT record to the zone as generated by OpenDKIM.