fix soa records

This commit is contained in:
Jörg Thalheim 2020-08-12 18:09:24 +01:00
parent dd18a4435e
commit f5a95a5583
No known key found for this signature in database
GPG Key ID: 003F2096411B5F92
9 changed files with 15 additions and 13 deletions

View File

@ -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")

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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