From 36e5f07f8dda51cc5bb0a105077e751f1c851435 Mon Sep 17 00:00:00 2001 From: Lucas Christian Date: Thu, 7 Oct 2021 20:41:02 -0700 Subject: T562: Config syntax for defining DNS forward authoritative zones --- interface-definitions/dns-forwarding.xml.in | 452 +++++++++++++++++++++++++++- 1 file changed, 451 insertions(+), 1 deletion(-) (limited to 'interface-definitions/dns-forwarding.xml.in') diff --git a/interface-definitions/dns-forwarding.xml.in b/interface-definitions/dns-forwarding.xml.in index 5b0c87597..ced138bff 100644 --- a/interface-definitions/dns-forwarding.xml.in +++ b/interface-definitions/dns-forwarding.xml.in @@ -105,6 +105,456 @@ + + + Domain to host authoritative records for + + text + An absolute DNS name + + + ^[-_a-zA-Z0-9.]{1,63}$ + + + + + + DNS zone records + + + + + "A" record + + text + A DNS name relative to the root record + + + @ + Root record + + + ^([-_a-zA-Z0-9.]{1,63}|@)(?<!\.)$ + + + + + + IPv4 address [REQUIRED] + + ipv4 + IPv4 address + + + + + + + + #include + #include + + + + + "AAAA" record + + text + A DNS name relative to the root record + + + @ + Root record + + + ^([-_a-zA-Z0-9.]{1,63}|@)(?<!\.)$ + + + + + + IPv6 address [REQUIRED] + + ipv6 + IPv6 address + + + + + + + + #include + #include + + + + + "CNAME" record + + text + A DNS name relative to the root record + + + @ + Root record + + + ^([-_a-zA-Z0-9.]{1,63}|@)(?<!\.)$ + + + + + + Target DNS name [REQUIRED] + + name.example.com + An absolute DNS name + + + ^[-_a-zA-Z0-9.]{1,63}(?<!\.)$ + + + + #include + #include + + + + + "MX" record + + text + A DNS name relative to the root record + + + @ + Root record + + + ^([-_a-zA-Z0-9.]{1,63}|@)(?<!\.)$ + + + + + + Mail server [REQUIRED] + + name.example.com + An absolute DNS name + + + ^[-_a-zA-Z0-9.]{1,63}(?<!\.)$ + + + + + + Server priority + + u32:1-999 + Server priority (lower numbers are higher priority) + + + + + + 10 + + + + #include + #include + + + + + "PTR" record + + text + A DNS name relative to the root record + + + @ + Root record + + + ^([-_a-zA-Z0-9.]{1,63}|@)(?<!\.)$ + + + + + + Target DNS name [REQUIRED] + + name.example.com + An absolute DNS name + + + ^[-_a-zA-Z0-9.]{1,63}(?<!\.)$ + + + + #include + #include + + + + + "TXT" record + + text + A DNS name relative to the root record + + + @ + Root record + + + ^([-_a-zA-Z0-9.]{1,63}|@)(?<!\.)$ + + + + + + Record contents [REQUIRED] + + text + Record contents + + + + + #include + #include + + + + + "SPF" record (type=SPF) + + text + A DNS name relative to the root record + + + @ + Root record + + + ^([-_a-zA-Z0-9.]{1,63}|@)(?<!\.)$ + + + + + + Record contents [REQUIRED] + + text + Record contents + + + + #include + #include + + + + + Host an DNS "SRV" record + + text + A DNS name relative to the root record + + + @ + Root record + + + ^([-_a-zA-Z0-9.]{1,63}|@)(?<!\.)$ + + + + + + Service entry [REQUIRED] + + u32:0-65535 + Entry number + + + + + + + + + Server hostname [REQUIRED] + + name.example.com + An absolute DNS name + + + ^[-_a-zA-Z0-9.]{1,63}(?<!\.)$ + + + + + + Port number [REQUIRED] + + u32:0-65535 + TCP/UDP port number + + + + + + + + + Entry priority + + u32:0-65535 + Entry priority (lower numbers are higher priority) + + + + + + 10 + + + + Entry weight + + u32:0-65535 + Entry weight + + + + + + 0 + + + + #include + #include + + + + + "NAPTR" record + + text + A DNS name relative to the root record + + + @ + Root record + + + ^([-_a-zA-Z0-9.]{1,63}|@)(?<!\.)$ + + + + + + NAPTR rule [REQUIRED] + + u32:0-65535 + Rule number + + + + + + + + + Rule order + + u32:0-65535 + Rule order (lower order is evaluated first) + + + + + + + + + Rule preference + + u32:0-65535 + Rule preference + + + + + + 0 + + + + "S" flag + + + + + + "A" flag + + + + + + "U" flag + + + + + + "P" flag + + + + + + Service type + + ^[a-zA-Z][a-zA-Z0-9]{0,31}(\+[a-zA-Z][a-zA-Z0-9]{0,31})?$ + + + + + + Regular expression + + + + + Replacement DNS name + + name.example.com + An absolute DNS name + + + ^[-_a-zA-Z0-9.]{1,63}(?<!\.)$ + + + + + + #include + #include + + + + + #include + + Do not use local /etc/hosts file in name resolution @@ -114,7 +564,7 @@ Makes the server authoritatively not aware of RFC1918 addresses - + -- cgit v1.2.3 From d6a79444ff131220529938b0ff849f43f3a9e1c0 Mon Sep 17 00:00:00 2001 From: Lucas Christian Date: Tue, 12 Oct 2021 22:51:29 -0700 Subject: Fix default values --- interface-definitions/dns-forwarding.xml.in | 2 +- src/conf_mode/dns_forwarding.py | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'interface-definitions/dns-forwarding.xml.in') diff --git a/interface-definitions/dns-forwarding.xml.in b/interface-definitions/dns-forwarding.xml.in index ced138bff..4faf604ad 100644 --- a/interface-definitions/dns-forwarding.xml.in +++ b/interface-definitions/dns-forwarding.xml.in @@ -360,7 +360,7 @@ - Host an DNS "SRV" record + "SRV" record text A DNS name relative to the root record diff --git a/src/conf_mode/dns_forwarding.py b/src/conf_mode/dns_forwarding.py index 278fa7226..5a5ae4d14 100755 --- a/src/conf_mode/dns_forwarding.py +++ b/src/conf_mode/dns_forwarding.py @@ -94,7 +94,7 @@ def get_config(config=None): rdata = recorddata[rtype][subnode] if rtype in [ 'a', 'aaaa' ]: - rdefaults = defaults(base + ['authoritative-domain', rtype]) # T2665 + rdefaults = defaults(base + ['authoritative-domain', 'records', rtype]) # T2665 rdata = dict_merge(rdefaults, rdata) if not 'address' in rdata: @@ -109,7 +109,7 @@ def get_config(config=None): 'value': address }) elif rtype in ['cname', 'ptr']: - rdefaults = defaults(base + ['authoritative-domain', rtype]) # T2665 + rdefaults = defaults(base + ['authoritative-domain', 'records', rtype]) # T2665 rdata = dict_merge(rdefaults, rdata) if not 'target' in rdata: @@ -123,7 +123,7 @@ def get_config(config=None): 'value': '{}.'.format(rdata['target']) }) elif rtype == 'mx': - rdefaults = defaults(base + ['authoritative-domain', rtype]) # T2665 + rdefaults = defaults(base + ['authoritative-domain', 'records', rtype]) # T2665 del rdefaults['server'] rdata = dict_merge(rdefaults, rdata) @@ -133,7 +133,7 @@ def get_config(config=None): for servername in rdata['server']: serverdata = rdata['server'][servername] - serverdefaults = defaults(base + ['authoritative-domain', rtype, 'server']) # T2665 + serverdefaults = defaults(base + ['authoritative-domain', 'records', rtype, 'server']) # T2665 serverdata = dict_merge(serverdefaults, serverdata) zone['records'].append({ 'name': subnode, @@ -142,7 +142,7 @@ def get_config(config=None): 'value': '{} {}.'.format(serverdata['priority'], servername) }) elif rtype == 'txt': - rdefaults = defaults(base + ['authoritative-domain', rtype]) # T2665 + rdefaults = defaults(base + ['authoritative-domain', 'records', rtype]) # T2665 rdata = dict_merge(rdefaults, rdata) if not 'value' in rdata: @@ -157,7 +157,7 @@ def get_config(config=None): 'value': "\"{}\"".format(value.replace("\"", "\\\"")) }) elif rtype == 'spf': - rdefaults = defaults(base + ['authoritative-domain', rtype]) # T2665 + rdefaults = defaults(base + ['authoritative-domain', 'records', rtype]) # T2665 rdata = dict_merge(rdefaults, rdata) if not 'value' in rdata: @@ -171,7 +171,7 @@ def get_config(config=None): 'value': '"{}"'.format(rdata['value'].replace("\"", "\\\"")) }) elif rtype == 'srv': - rdefaults = defaults(base + ['authoritative-domain', rtype]) # T2665 + rdefaults = defaults(base + ['authoritative-domain', 'records', rtype]) # T2665 del rdefaults['entry'] rdata = dict_merge(rdefaults, rdata) @@ -181,7 +181,7 @@ def get_config(config=None): for entryno in rdata['entry']: entrydata = rdata['entry'][entryno] - entrydefaults = defaults(base + ['authoritative-domain', rtype, 'entry']) # T2665 + entrydefaults = defaults(base + ['authoritative-domain', 'records', rtype, 'entry']) # T2665 entrydata = dict_merge(entrydefaults, entrydata) if not 'hostname' in entrydata: @@ -199,7 +199,7 @@ def get_config(config=None): 'value': '{} {} {} {}.'.format(entrydata['priority'], entrydata['weight'], entrydata['port'], entrydata['hostname']) }) elif rtype == 'naptr': - rdefaults = defaults(base + ['authoritative-domain', rtype]) # T2665 + rdefaults = defaults(base + ['authoritative-domain', 'records', rtype]) # T2665 del rdefaults['rule'] rdata = dict_merge(rdefaults, rdata) @@ -210,7 +210,7 @@ def get_config(config=None): for ruleno in rdata['rule']: ruledata = rdata['rule'][ruleno] - ruledefaults = defaults(base + ['authoritative-domain', rtype, 'rule']) # T2665 + ruledefaults = defaults(base + ['authoritative-domain', 'records', rtype, 'rule']) # T2665 ruledata = dict_merge(ruledefaults, ruledata) flags = "" if 'lookup-srv' in ruledata: -- cgit v1.2.3