From 24cc1081478eccc79c1d412e09b36e52c840607d 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 | 7 +++++++ management/dns_update.py | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54abdb7..2fd235f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ CHANGELOG ========= +Development +----------- + +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. + v0.06 (January 4, 2015) ----------------------- diff --git a/management/dns_update.py b/management/dns_update.py index 7c01f6d..cb0eb86 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.