From e00771992633d084c57e312f209887db2a7ff1a6 Mon Sep 17 00:00:00 2001 From: Charlie Jacomme Date: Wed, 8 Aug 2018 11:17:12 +0200 Subject: [PATCH 1/4] template fixes --- main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 8824b9d..4831515 100755 --- a/main.py +++ b/main.py @@ -23,14 +23,14 @@ template_soa = ("$ORIGIN {zone}.\n" ")") template_originv4 = "@ IN A {ipv4}" template_originv6 = "@ IN AAAA {ipv6}" -template_ns = "@ IN NS {target}" -template_mx = "@ IN MX {priority} {target}" +template_ns = "@ IN NS {target}." +template_mx = "@ IN MX {priority} {target}." template_txt = "{field1} IN TXT {field2}" template_srv = "_{service}._{protocol}.{zone} {ttl} IN SRV {priority} {weight} {port} {target}" template_a = "{hostname} IN A {ipv4}" template_aaaa = "{hostname} IN AAAA {ipv6}" template_cname = "{hostname} IN CNAME {alias}" -template_ptr = "{target} IN PTR {hostname}" +template_ptr = "{target} IN PTR {hostname}." template_zone = ("$TTL 2D\n" "{soa}\n" From a56e9c444cc743586ebdf7447103cf54f61fdaf8 Mon Sep 17 00:00:00 2001 From: Charlie Jacomme Date: Wed, 8 Aug 2018 11:59:08 +0200 Subject: [PATCH 2/4] fix aliases --- main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 4831515..08fb84b 100755 --- a/main.py +++ b/main.py @@ -29,7 +29,7 @@ template_txt = "{field1} IN TXT {field2}" template_srv = "_{service}._{protocol}.{zone} {ttl} IN SRV {priority} {weight} {port} {target}" template_a = "{hostname} IN A {ipv4}" template_aaaa = "{hostname} IN AAAA {ipv6}" -template_cname = "{hostname} IN CNAME {alias}" +template_cname = "{hostname} IN CNAME {alias}." template_ptr = "{target} IN PTR {hostname}." template_zone = ("$TTL 2D\n" @@ -138,7 +138,7 @@ def write_dns_files(api_client): cname_records = "\n".join( template_cname.format(hostname=x['hostname'], - alias=x['alias'],extension=x['extension']) + alias=x['alias']) for x in zone['cname_records'] ) From 3fc12f60070cd1e4dc4e0961cdc21dccb5272081 Mon Sep 17 00:00:00 2001 From: Charlie Jacomme Date: Wed, 8 Aug 2018 11:59:24 +0200 Subject: [PATCH 3/4] ipv6 reverse fix --- main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 08fb84b..363b6af 100755 --- a/main.py +++ b/main.py @@ -262,7 +262,7 @@ def write_dns_reverse_file(api_client): net_class = max(((net.prefixlen - 1) // 4) + 1, 1) zone6_name = ".".join( netaddr.IPAddress(net.first).reverse_dns.split('.')[32 - net_class:] - ) + )[:-1] soa = template_soa.format(zone=zone6_name, @@ -288,7 +288,7 @@ def write_dns_reverse_file(api_client): ptr_records = ptr_records) - filename = 'generated/dns.{zone}zone'.format(zone=zone6_name) + filename = 'generated/dns.{zone}.zone'.format(zone=zone6_name) with open(filename, 'a') as f: f.write(zone_file_content) else: @@ -299,7 +299,7 @@ def write_dns_reverse_file(api_client): ptr_records = ptr_records) - filename = 'generated/dns.{zone}zone'.format(zone=zone6_name) + filename = 'generated/dns.{zone}.zone'.format(zone=zone6_name) with open(filename, 'w+') as f: f.write(zone_file_content) zone_v6.append(zone6_name) From 79b2bc36555b7f6748bc390fdb417662e31b0cba Mon Sep 17 00:00:00 2001 From: Charlie Jacomme Date: Wed, 8 Aug 2018 12:47:09 +0200 Subject: [PATCH 4/4] soa fix --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index 363b6af..a0add79 100755 --- a/main.py +++ b/main.py @@ -14,7 +14,7 @@ api_password = config.get('Re2o', 'password') api_username = config.get('Re2o', 'username') template_soa = ("$ORIGIN {zone}.\n" - "@ IN SOA {ns} {mail} (\n" + "@ IN SOA {ns}. {mail} (\n" " {serial} ; serial\n" " {refresh} ; refresh\n" " {retry} ; retry\n"