Commit 42c89103 authored by Joshua Tauberer's avatar Joshua Tauberer

don't create a www. subdomain on any domains that are themselves subdomains...

don't create a www. subdomain on any domains that are themselves subdomains within a zone, i.e. don't create www.PUBLIC_HOSTNAME if PUBLIC_HOSTNAME is a subdomain of another domain, which is what we normally recommend
parent d7a9e7cc
......@@ -126,13 +126,13 @@ def do_dns_update(env):
########################################################################
def build_zone(domain, all_domains, additional_records, env, with_ns=True):
def build_zone(domain, all_domains, additional_records, env, is_zone=True):
records = []
# For top-level zones, define ourselves as the authoritative name server.
# 'False' in the tuple indicates these records would not be used if the zone
# is managed outside of the box.
if with_ns:
if is_zone:
records.append((None, "NS", "ns1.%s." % env["PRIMARY_HOSTNAME"], False))
records.append((None, "NS", "ns2.%s." % env["PRIMARY_HOSTNAME"], False))
......@@ -164,7 +164,7 @@ def build_zone(domain, all_domains, additional_records, env, with_ns=True):
subdomains = [d for d in all_domains if d.endswith("." + domain)]
for subdomain in subdomains:
subdomain_qname = subdomain[0:-len("." + domain)]
subzone = build_zone(subdomain, [], {}, env, with_ns=False)
subzone = build_zone(subdomain, [], {}, env, is_zone=False)
for child_qname, child_rtype, child_value, child_explanation in subzone:
if child_qname == None:
child_qname = subdomain_qname
......@@ -205,6 +205,7 @@ def build_zone(domain, all_domains, additional_records, env, with_ns=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):
records.append((qname, rtype, value, explanation))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment