Compare commits

...
Sign in to create a new pull request.

4 commits

Author SHA1 Message Date
Jean-Marie Mineau
f8a7c1b580 ignore ipv6 with the 'active' field set to false 2020-08-04 22:27:43 +02:00
klafyvel
0d82a4cf99 Merge branch 'tamytro/srv-underscore-fix' into 'master'
(template_srv) Let the user define the `service` part in full (as opposed to

See merge request re2o/dns!2
2020-04-26 14:21:29 +02:00
Romain DEP.
6710dfde1b (template_srv) Let the user define the service part in full (as opposed to
adding it automatically)
    This is consistent with re2o/machines/models.py
2020-04-26 14:09:24 +02:00
chirac
969afb1160 Merge branch 'improve-configuration-file' into 'master'
Add parameters for tls and knot

See merge request re2o/dns!1
2020-01-17 21:31:30 +01:00

View file

@ -42,7 +42,7 @@ template_originv6 = "@ IN AAAA {ipv6}"
template_ns = "@ IN NS {target}." template_ns = "@ IN NS {target}."
template_mx = "@ IN MX {priority} {target}." template_mx = "@ IN MX {priority} {target}."
template_txt = "{field1} IN TXT {field2}" template_txt = "{field1} IN TXT {field2}"
template_srv = "_{service}._{protocole}.{zone}. {ttl} IN SRV {priority} {weight} {port} {target}" template_srv = "{service}._{protocole}.{zone}. {ttl} IN SRV {priority} {weight} {port} {target}"
template_a = "{hostname} IN A {ipv4}" template_a = "{hostname} IN A {ipv4}"
template_aaaa = "{hostname} IN AAAA {ipv6}" template_aaaa = "{hostname} IN AAAA {ipv6}"
template_cname = "{hostname} IN CNAME {alias}." template_cname = "{hostname} IN CNAME {alias}."
@ -203,7 +203,7 @@ def write_dns_file(zone, verbose=False):
) )
for x in zone['aaaa_records'] for x in zone['aaaa_records']
for ip in x['ipv6'] for ip in x['ipv6']
if x['ipv6'] is not None if x['ipv6'] is not None and ip['active']
) )
cname_records = "\n".join( cname_records = "\n".join(
@ -346,13 +346,12 @@ def write_dns_reverse_file(api_client):
expire=zone['soa']['expire'], expire=zone['soa']['expire'],
ttl=zone['soa']['ttl'] ttl=zone['soa']['ttl']
) )
ptr_records = "\n".join( ptr_records = "\n".join(
template_ptr.format( template_ptr.format(
hostname=host['hostname']+extension, hostname=host['hostname']+extension,
target=get_ip_reverse(host['ipv4'],prefix_length) target=get_ip_reverse(host['ipv4'],prefix_length)
) )
for host in zone['ptr_records'] if host['ipv4'] in subnet for host in zone['ptr_records'] if host['ipv4'] in subnet and host['hostname']
) )
zone_file_content = template_reverse.format( zone_file_content = template_reverse.format(
soa=soa, soa=soa,
@ -388,7 +387,7 @@ def write_dns_reverse_file(api_client):
ptr_records = "\n".join( ptr_records = "\n".join(
template_ptr.format(hostname=host['hostname']+extension, template_ptr.format(hostname=host['hostname']+extension,
target=get_ip_reverse(ip['ipv6'],prefix_length)) target=get_ip_reverse(ip['ipv6'],prefix_length))
for host in zone['ptr_v6_records'] for ip in host['ipv6'] for host in zone['ptr_v6_records'] for ip in host['ipv6'] if ip['active']
) )
if zone6_name in zone_v6: if zone6_name in zone_v6:
# we already created the file, we ignore the soa # we already created the file, we ignore the soa