diff --git a/management/dns_update.py b/management/dns_update.py index 9925840f..331ab764 100755 --- a/management/dns_update.py +++ b/management/dns_update.py @@ -222,7 +222,11 @@ 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) and not has_rec(qname, "CNAME"): + # Set the default record, but not if: + # (1) there is not a user-set record of the same type already + # (2) there is not a CNAME record already, since you can't set both and who knows what takes precedence + # (2) there is not an A record already (if this is an A record this is a dup of (1), and if this is an AAAA record then don't set a default AAAA record if the user sets a custom A record, since the default wouldn't make sense and it should not resolve if the user doesn't provide a new AAAA record) + if not has_rec(qname, rtype) and not has_rec(qname, "CNAME") and not has_rec(qname, "A"): records.append((qname, rtype, value, explanation)) # Append the DKIM TXT record to the zone as generated by OpenDKIM.