fix soa records
This commit is contained in:
parent
dd18a4435e
commit
f5a95a5583
@ -5,9 +5,11 @@ import datetime
|
|||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from typing import DefaultDict, Any
|
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
|
@ 3600 IN NS ns1
|
||||||
ns1 IN A 10.243.29.174
|
ns1 IN A 10.243.29.174
|
||||||
ns2 IN A 42:0:3c46:70c7:8526:2adf:7451:8bbb
|
ns2 IN A 42:0:3c46:70c7:8526:2adf:7451:8bbb
|
||||||
@ -30,19 +32,19 @@ def main() -> None:
|
|||||||
|
|
||||||
for zone, hosts in dns.items():
|
for zone, hosts in dns.items():
|
||||||
with open(f"{zone}.zone", "w") as f:
|
with open(f"{zone}.zone", "w") as f:
|
||||||
f.write(HEADER)
|
f.write(zone_header(zone))
|
||||||
for name, record in hosts.items():
|
for name, record in hosts.items():
|
||||||
for rtype, ip in record.items():
|
for rtype, ip in record.items():
|
||||||
f.write(f"{name} IN {rtype} {ip}\n")
|
f.write(f"{name} IN {rtype} {ip}\n")
|
||||||
|
|
||||||
with open("240.10.zone", "w") as f:
|
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():
|
for ip, name in rdns.items():
|
||||||
if "." in ip and ip.startswith("10.2"):
|
if "." in ip and ip.startswith("10.2"):
|
||||||
f.write(f"{ip}. IN PTR {name}.\n")
|
f.write(f"{ip}. IN PTR {name}.\n")
|
||||||
|
|
||||||
with open("42.zone", "w") as f:
|
with open("42.zone", "w") as f:
|
||||||
f.write(HEADER)
|
f.write(zone_header("2.4.ip6.arpa"))
|
||||||
for ip, name in rdns.items():
|
for ip, name in rdns.items():
|
||||||
if ":" in ip and ip.startswith("42:"):
|
if ":" in ip and ip.startswith("42:"):
|
||||||
f.write(f"{ip}. IN PTR {name}.\n")
|
f.write(f"{ip}. IN PTR {name}.\n")
|
||||||
|
@ -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
|
@ 3600 IN NS ns1
|
||||||
ns1 IN A 10.243.29.174
|
ns1 IN A 10.243.29.174
|
||||||
ns2 IN A 42:0:3c46:70c7:8526:2adf:7451:8bbb
|
ns2 IN A 42:0:3c46:70c7:8526:2adf:7451:8bbb
|
||||||
|
@ -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
|
@ 3600 IN NS ns1
|
||||||
ns1 IN A 10.243.29.174
|
ns1 IN A 10.243.29.174
|
||||||
ns2 IN A 42:0:3c46:70c7:8526:2adf:7451:8bbb
|
ns2 IN A 42:0:3c46:70c7:8526:2adf:7451:8bbb
|
||||||
|
@ -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
|
@ 3600 IN NS ns1
|
||||||
ns1 IN A 10.243.29.174
|
ns1 IN A 10.243.29.174
|
||||||
ns2 IN A 42:0:3c46:70c7:8526:2adf:7451:8bbb
|
ns2 IN A 42:0:3c46:70c7:8526:2adf:7451:8bbb
|
||||||
|
@ -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
|
@ 3600 IN NS ns1
|
||||||
ns1 IN A 10.243.29.174
|
ns1 IN A 10.243.29.174
|
||||||
ns2 IN A 42:0:3c46:70c7:8526:2adf:7451:8bbb
|
ns2 IN A 42:0:3c46:70c7:8526:2adf:7451:8bbb
|
||||||
|
@ -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
|
@ 3600 IN NS ns1
|
||||||
ns1 IN A 10.243.29.174
|
ns1 IN A 10.243.29.174
|
||||||
ns2 IN A 42:0:3c46:70c7:8526:2adf:7451:8bbb
|
ns2 IN A 42:0:3c46:70c7:8526:2adf:7451:8bbb
|
||||||
|
@ -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
|
@ 3600 IN NS ns1
|
||||||
ns1 IN A 10.243.29.174
|
ns1 IN A 10.243.29.174
|
||||||
ns2 IN A 42:0:3c46:70c7:8526:2adf:7451:8bbb
|
ns2 IN A 42:0:3c46:70c7:8526:2adf:7451:8bbb
|
||||||
|
@ -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
|
@ 3600 IN NS ns1
|
||||||
ns1 IN A 10.243.29.174
|
ns1 IN A 10.243.29.174
|
||||||
ns2 IN A 42:0:3c46:70c7:8526:2adf:7451:8bbb
|
ns2 IN A 42:0:3c46:70c7:8526:2adf:7451:8bbb
|
||||||
|
@ -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
|
@ 3600 IN NS ns1
|
||||||
ns1 IN A 10.243.29.174
|
ns1 IN A 10.243.29.174
|
||||||
ns2 IN A 42:0:3c46:70c7:8526:2adf:7451:8bbb
|
ns2 IN A 42:0:3c46:70c7:8526:2adf:7451:8bbb
|
||||||
|
Loading…
Reference in New Issue
Block a user