From f5a95a5583ecfaef3fd2f9ea249afc2c32021a01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Wed, 12 Aug 2020 18:09:24 +0100 Subject: [PATCH] fix soa records --- scripts/generate-zone.py | 12 +++++++----- zones/240.10.zone | 2 +- zones/42.zone | 2 +- zones/gg23.zone | 2 +- zones/i.zone | 2 +- zones/lan.zone | 2 +- zones/r.zone | 2 +- zones/shack.zone | 2 +- zones/w.zone | 2 +- 9 files changed, 15 insertions(+), 13 deletions(-) diff --git a/scripts/generate-zone.py b/scripts/generate-zone.py index a8c5387..f93ffb3 100644 --- a/scripts/generate-zone.py +++ b/scripts/generate-zone.py @@ -5,9 +5,11 @@ import datetime from collections import defaultdict from typing import DefaultDict, Any -serial = datetime.datetime.now().strftime("%Y%M%d%h") +serial = datetime.datetime.now().strftime("%Y%M%d%H") -HEADER = f"""@ 3600 IN SOA r. root.r. {serial} 7200 3600 86400 3600 + +def zone_header(domain: str) -> str: + return f"""@ 3600 IN SOA {domain}. root.r. {serial} 7200 3600 86400 3600 @ 3600 IN NS ns1 ns1 IN A 10.243.29.174 ns2 IN A 42:0:3c46:70c7:8526:2adf:7451:8bbb @@ -30,19 +32,19 @@ def main() -> None: for zone, hosts in dns.items(): with open(f"{zone}.zone", "w") as f: - f.write(HEADER) + f.write(zone_header(zone)) for name, record in hosts.items(): for rtype, ip in record.items(): f.write(f"{name} IN {rtype} {ip}\n") with open("240.10.zone", "w") as f: - f.write(HEADER) + f.write(zone_header("240.10.in-addr.arpa")) for ip, name in rdns.items(): if "." in ip and ip.startswith("10.2"): f.write(f"{ip}. IN PTR {name}.\n") with open("42.zone", "w") as f: - f.write(HEADER) + f.write(zone_header("2.4.ip6.arpa")) for ip, name in rdns.items(): if ":" in ip and ip.startswith("42:"): f.write(f"{ip}. IN PTR {name}.\n") diff --git a/zones/240.10.zone b/zones/240.10.zone index a4bc380..91e93c9 100644 --- a/zones/240.10.zone +++ b/zones/240.10.zone @@ -1,4 +1,4 @@ -@ 3600 IN SOA r. root.r. 20204812Aug 7200 3600 86400 3600 +@ 3600 IN SOA 240.10.in-addr.arpa. root.r. 2020081218 7200 3600 86400 3600 @ 3600 IN NS ns1 ns1 IN A 10.243.29.174 ns2 IN A 42:0:3c46:70c7:8526:2adf:7451:8bbb diff --git a/zones/42.zone b/zones/42.zone index 32b1c4d..7c7c607 100644 --- a/zones/42.zone +++ b/zones/42.zone @@ -1,4 +1,4 @@ -@ 3600 IN SOA r. root.r. 20204812Aug 7200 3600 86400 3600 +@ 3600 IN SOA 2.4.ip6.arpa. root.r. 2020081218 7200 3600 86400 3600 @ 3600 IN NS ns1 ns1 IN A 10.243.29.174 ns2 IN A 42:0:3c46:70c7:8526:2adf:7451:8bbb diff --git a/zones/gg23.zone b/zones/gg23.zone index c2212c6..f04c5a4 100644 --- a/zones/gg23.zone +++ b/zones/gg23.zone @@ -1,4 +1,4 @@ -@ 3600 IN SOA r. root.r. 20204812Aug 7200 3600 86400 3600 +@ 3600 IN SOA gg23. root.r. 2020081218 7200 3600 86400 3600 @ 3600 IN NS ns1 ns1 IN A 10.243.29.174 ns2 IN A 42:0:3c46:70c7:8526:2adf:7451:8bbb diff --git a/zones/i.zone b/zones/i.zone index 3176436..9b42636 100644 --- a/zones/i.zone +++ b/zones/i.zone @@ -1,4 +1,4 @@ -@ 3600 IN SOA r. root.r. 20204812Aug 7200 3600 86400 3600 +@ 3600 IN SOA i. root.r. 2020081218 7200 3600 86400 3600 @ 3600 IN NS ns1 ns1 IN A 10.243.29.174 ns2 IN A 42:0:3c46:70c7:8526:2adf:7451:8bbb diff --git a/zones/lan.zone b/zones/lan.zone index ecf1e58..beda25a 100644 --- a/zones/lan.zone +++ b/zones/lan.zone @@ -1,4 +1,4 @@ -@ 3600 IN SOA r. root.r. 20204812Aug 7200 3600 86400 3600 +@ 3600 IN SOA lan. root.r. 2020081218 7200 3600 86400 3600 @ 3600 IN NS ns1 ns1 IN A 10.243.29.174 ns2 IN A 42:0:3c46:70c7:8526:2adf:7451:8bbb diff --git a/zones/r.zone b/zones/r.zone index 3ba5a6b..9c76f09 100644 --- a/zones/r.zone +++ b/zones/r.zone @@ -1,4 +1,4 @@ -@ 3600 IN SOA r. root.r. 20204812Aug 7200 3600 86400 3600 +@ 3600 IN SOA r. root.r. 2020081218 7200 3600 86400 3600 @ 3600 IN NS ns1 ns1 IN A 10.243.29.174 ns2 IN A 42:0:3c46:70c7:8526:2adf:7451:8bbb diff --git a/zones/shack.zone b/zones/shack.zone index e7df38b..d240761 100644 --- a/zones/shack.zone +++ b/zones/shack.zone @@ -1,4 +1,4 @@ -@ 3600 IN SOA r. root.r. 20204812Aug 7200 3600 86400 3600 +@ 3600 IN SOA shack. root.r. 2020081218 7200 3600 86400 3600 @ 3600 IN NS ns1 ns1 IN A 10.243.29.174 ns2 IN A 42:0:3c46:70c7:8526:2adf:7451:8bbb diff --git a/zones/w.zone b/zones/w.zone index 07445e8..0af546f 100644 --- a/zones/w.zone +++ b/zones/w.zone @@ -1,4 +1,4 @@ -@ 3600 IN SOA r. root.r. 20204812Aug 7200 3600 86400 3600 +@ 3600 IN SOA w. root.r. 2020081218 7200 3600 86400 3600 @ 3600 IN NS ns1 ns1 IN A 10.243.29.174 ns2 IN A 42:0:3c46:70c7:8526:2adf:7451:8bbb