diff --git a/dns/db.10.127 b/dns/db.10.127 index 8623bb4..28b45ae 100644 --- a/dns/db.10.127 +++ b/dns/db.10.127 @@ -1,11 +1,11 @@ ; NeoNetwork DNS Record $TTL 3600 @ IN SOA root-dns.neo. root.neo. ( - 4096 ; Serial - 900 ; Refresh - 900 ; Retry - 86400 ; Expire - 900 ) ; Negative Cache TTL + 4096 ; Serial + 900 ; Refresh + 900 ; Retry + 86400 ; Expire + 900 ) ; Negative Cache TTL ; @ IN NS NeoPDP-11.neo. diff --git a/dns/db.fd10.127 b/dns/db.fd10.127 index 65fe549..327cdb1 100644 --- a/dns/db.fd10.127 +++ b/dns/db.fd10.127 @@ -1,11 +1,11 @@ ; NeoNetwork DNS Record $TTL 3600 @ IN SOA root-dns.neo. root.neo. ( - 4096 ; Serial - 900 ; Refresh - 900 ; Retry - 86400 ; Expire - 900 ) ; Negative Cache TTL + 4096 ; Serial + 900 ; Refresh + 900 ; Retry + 86400 ; Expire + 900 ) ; Negative Cache TTL ; @ IN NS NeoPDP-11.neo. diff --git a/dns/neonetwork b/dns/neonetwork index b0e8975..7676229 100644 --- a/dns/neonetwork +++ b/dns/neonetwork @@ -1,11 +1,11 @@ ; NeoNetwork DNS Record $TTL 3600 @ IN SOA root-dns.neo. root.neo. ( - 4096 ; Serial - 900 ; Refresh - 900 ; Retry - 86400 ; Expire - 900 ) ; Negative Cache TTL + 4096 ; Serial + 900 ; Refresh + 900 ; Retry + 86400 ; Expire + 900 ) ; Negative Cache TTL ; ; NeoNetwork Original diff --git a/scripts/generate-roa.sh b/scripts/generate-roa.sh index 6ad09ab..88b5fc1 100755 --- a/scripts/generate-roa.sh +++ b/scripts/generate-roa.sh @@ -22,4 +22,6 @@ scripts/roa.py -m "$MAX_LEN_4" -M "$MAX_LEN_6" -e -o generated/neonetwork.json scripts/roa.py -m "$MAX_LEN_4" -M "$MAX_LEN_6" -r -o generated/rfc8416.json scripts/roa.py --summary --output generated/README.md +scripts/update-zone-serial.py + scripts/check-named-zones.sh diff --git a/scripts/update-zone-serial.py b/scripts/update-zone-serial.py new file mode 100755 index 0000000..2e599aa --- /dev/null +++ b/scripts/update-zone-serial.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python3 +from pathlib import Path +import subprocess +from time import time +from re import match +from os import chdir + +chdir("generated") + +zone_files = [ + 'neonetwork', + 'db.10.127', + 'db.fd10.127', +] + +serial_base = 1586876035 + +for zone in zone_files: + zone = Path("dns") / zone + assert zone.exists() + p = subprocess.run(['git', 'diff', '--exit-code', str(zone)]) + if p.returncode == 0: + print(f"skip {zone.name}") + else: + print(f"update serial {zone.name}") + lines = zone.read_text().split("\n") + processed = list() + serial = int(time()) - serial_base + assert 0 < serial <= 2**32 + serial = str(serial) + found = False + for line in lines: + if not found and (m := match(r"^(\s+)([0-9]+)(\s*;\s*Serial\s*)$", line)): + prefix, _serial, suffix = m.groups() + print(f"{_serial=} {serial=}") + plen = max(len(prefix) - len(serial) + len(_serial), 0) + processed.append(f"{' '*plen}{serial}{suffix}") + found = True + else: + processed.append(line) + zone.write_text("\n".join(processed))