From 749b5cf78cb791c7c330092265b9800bf2a2b299 Mon Sep 17 00:00:00 2001 From: Jerry Date: Wed, 14 Apr 2021 14:30:56 +0800 Subject: [PATCH] format dns and change ttl --- dns/db.10.127 | 112 +++++++++++++------------- dns/db.fd10.127 | 40 +++++----- dns/neonetwork | 147 +++++++++++++++++------------------ scripts/check-named-zones.sh | 2 +- scripts/named-formatzone.py | 56 +++++++++++++ 5 files changed, 206 insertions(+), 151 deletions(-) create mode 100644 scripts/named-formatzone.py diff --git a/dns/db.10.127 b/dns/db.10.127 index d883585..08a6cc1 100644 --- a/dns/db.10.127 +++ b/dns/db.10.127 @@ -1,74 +1,74 @@ ; NeoNetwork DNS Record -$TTL 604800 -@ IN SOA NeoPDP-11.neo. root.neo. ( - 4096 ; Serial - 604800 ; Refresh - 86400 ; Retry - 2419200 ; Expire - 604800 ) ; Negative Cache TTL +$TTL 3600 +@ IN SOA root-dns.neo. root.neo. ( + 4096 ; Serial + 900 ; Refresh + 900 ; Retry + 86400 ; Expire + 900 ) ; Negative Cache TTL ; -@ IN NS NeoPDP-11.neo. +@ IN NS NeoPDP-11.neo. -; -1.1 IN PTR NeoPDP-11.neo. -40.1 IN PTR cklvax.neo. -63.1 IN PTR NNPCC.neo. -20.1 IN PTR NeoBOX.neo. -10.1 IN PTR neostorage.neonetwork. -80.1 IN PTR NeoSystem.neo. -1.3 IN PTR pan.neo. -16.2 IN PTR caasih.neo. -127.2 IN PTR NeoRouter.neo. -1.233 IN PTR liqingge.user-icecat.eth-ether5.cn.magicneko.neo. -1.234 IN PTR liqingge.user-icecat.eth-ether5.cn.magicneko.neo. -8.4 IN PTR koishi-v4.up-core.vtap-hentai-bb.hk.magicneko.neo. -10.4 IN PTR luotianyi-v4.up.vtap-hentai-bb.hk.magicneko.neo. -15.4 IN PTR yuezhengling-v4.up.vtap-hentai-bb.jp.magicneko.neo. +1.1 IN PTR NeoPDP-11.neo. +40.1 IN PTR cklvax.neo. +63.1 IN PTR NNPCC.neo. +20.1 IN PTR NeoBOX.neo. +10.1 IN PTR neostorage.neonetwork. +80.1 IN PTR NeoSystem.neo. +1.3 IN PTR pan.neo. +16.2 IN PTR caasih.neo. +127.2 IN PTR NeoRouter.neo. -1.14 IN PTR gr-0-1-0-0.cr2.hkg1.licson.neo. -2.14 IN PTR moecast.gr-0-1-0-0.cr2.hkg1.licson.neo. -5.14 IN PTR gr-0-1-0-1.cr2.hkg1.licson.neo. -6.14 IN PTR yura.gr-0-1-0-1.cr2.hkg1.licson.neo. -9.14 IN PTR gr-0-1-0-2.cr2.hkg1.licson.neo. -10.14 IN PTR neochen.gr-0-1-0-2.cr2.hkg1.licson.neo. -13.14 IN PTR gr-0-1-0-3.cr2.hkg1.licson.neo. -14.14 IN PTR jerry.gr-0-1-0-3.cr2.hkg1.licson.neo. -1.15 IN PTR ae-0-1.cr2.hkg1.licson.neo. +1.233 IN PTR liqingge.user-icecat.eth-ether5.cn.magicneko.neo. +1.234 IN PTR liqingge.user-icecat.eth-ether5.cn.magicneko.neo. +8.4 IN PTR koishi-v4.up-core.vtap-hentai-bb.hk.magicneko.neo. +10.4 IN PTR luotianyi-v4.up.vtap-hentai-bb.hk.magicneko.neo. +15.4 IN PTR yuezhengling-v4.up.vtap-hentai-bb.jp.magicneko.neo. -1.8 IN PTR librehs.neo. -2.8 IN PTR blog.librehs.neo. +1.14 IN PTR gr-0-1-0-0.cr2.hkg1.licson.neo. +2.14 IN PTR moecast.gr-0-1-0-0.cr2.hkg1.licson.neo. +5.14 IN PTR gr-0-1-0-1.cr2.hkg1.licson.neo. +6.14 IN PTR yura.gr-0-1-0-1.cr2.hkg1.licson.neo. +9.14 IN PTR gr-0-1-0-2.cr2.hkg1.licson.neo. +10.14 IN PTR neochen.gr-0-1-0-2.cr2.hkg1.licson.neo. +13.14 IN PTR gr-0-1-0-3.cr2.hkg1.licson.neo. +14.14 IN PTR jerry.gr-0-1-0-3.cr2.hkg1.licson.neo. +1.15 IN PTR ae-0-1.cr2.hkg1.licson.neo. -130.8 IN PTR edwardp.neo. +1.8 IN PTR librehs.neo. +2.8 IN PTR blog.librehs.neo. + +130.8 IN PTR edwardp.neo. ; Loopback Addresses -1.255 IN PTR NeoPDP-11.neo. -4.255 IN PTR fsnvax.neo. -18.255 IN PTR icecat-video.neo. -53.255 IN PTR root-dns.neo. -54.255 IN PTR dns.neo. -56.255 IN PTR frank-hsinchu-1.neo. -80.255 IN PTR NeoSystem.neo. -117.255 IN PTR magicneko-tw.neo. +1.255 IN PTR NeoPDP-11.neo. +4.255 IN PTR fsnvax.neo. +18.255 IN PTR icecat-video.neo. +53.255 IN PTR root-dns.neo. +54.255 IN PTR dns.neo. +56.255 IN PTR frank-hsinchu-1.neo. +80.255 IN PTR NeoSystem.neo. +117.255 IN PTR magicneko-tw.neo. ; DELEGATED ZONES -7 IN NS ns1.staph.neo. +7 IN NS ns1.staph.neo. -9 IN NS ns1.jerry.neo. -9 IN NS ns2.jerry.neo. +9 IN NS ns1.jerry.neo. +9 IN NS ns2.jerry.neo. -10 IN NS ns-anycast.lantian.neo. -10 IN NS ns1.lantian.neo. -10 IN NS ns2.lantian.neo. -10 IN NS ns3.lantian.neo. -10 IN NS ns4.lantian.neo. -10 IN NS ns5.lantian.neo. +10 IN NS ns-anycast.lantian.neo. +10 IN NS ns1.lantian.neo. +10 IN NS ns2.lantian.neo. +10 IN NS ns3.lantian.neo. +10 IN NS ns4.lantian.neo. +10 IN NS ns5.lantian.neo. -11 IN NS ns1.sun.dn42. +11 IN NS ns1.sun.dn42. -12 IN NS ns1.yangfl.dn42. -12 IN NS ns2.yangfl.dn42. +12 IN NS ns1.yangfl.dn42. +12 IN NS ns2.yangfl.dn42. -21 IN NS ns.iedon.neo. +21 IN NS ns.iedon.neo. diff --git a/dns/db.fd10.127 b/dns/db.fd10.127 index 8dbdc78..dc23d8e 100644 --- a/dns/db.fd10.127 +++ b/dns/db.fd10.127 @@ -1,32 +1,32 @@ ; NeoNetwork DNS Record -$TTL 604800 -@ IN SOA NeoPDP-11.neo. root.neo. ( +$TTL 3600 +@ IN SOA root-dns.neo. root.neo. ( 4096 ; Serial - 604800 ; Refresh - 86400 ; Retry - 2419200 ; Expire - 604800 ) ; Negative Cache TTL + 900 ; Refresh + 900 ; Retry + 86400 ; Expire + 900 ) ; Negative Cache TTL ; -@ IN NS NeoPDP-11.neo. +@ IN NS NeoPDP-11.neo. -1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.c.3.c.1.3.3.2.0 IN PTR liqingge.router.br-koishi.lo.she.as141706.koishi.moe. -0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.f.2.f.2 IN PTR edwardp.neo. +1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.c.3.c.1.3.3.2.0 IN PTR liqingge.router.br-koishi.lo.she.as141706.koishi.moe. +0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.f.2.f.2 IN PTR edwardp.neo. ; Loopback Addresses -0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.3.5.0.0.f.f.f.f IN PTR root-dns.neo. +0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.3.5.0.0.f.f.f.f IN PTR root-dns.neo. ; DELEGATED ZONES -3.5.0.0 IN NS ns1.jerry.neo. -3.5.0.0 IN NS ns2.jerry.neo. +3.5.0.0 IN NS ns1.jerry.neo. +3.5.0.0 IN NS ns2.jerry.neo. -0.1.0.0 IN NS ns-anycast.lantian.neo. -0.1.0.0 IN NS ns1.lantian.neo. -0.1.0.0 IN NS ns2.lantian.neo. -0.1.0.0 IN NS ns3.lantian.neo. -0.1.0.0 IN NS ns4.lantian.neo. -0.1.0.0 IN NS ns5.lantian.neo. +0.1.0.0 IN NS ns-anycast.lantian.neo. +0.1.0.0 IN NS ns1.lantian.neo. +0.1.0.0 IN NS ns2.lantian.neo. +0.1.0.0 IN NS ns3.lantian.neo. +0.1.0.0 IN NS ns4.lantian.neo. +0.1.0.0 IN NS ns5.lantian.neo. -7.0.0.0 IN NS ns1.staph.neo. -1.1.e.e IN NS ns1.sun.dn42. +7.0.0.0 IN NS ns1.staph.neo. +1.1.e.e IN NS ns1.sun.dn42. diff --git a/dns/neonetwork b/dns/neonetwork index 1e0fe2e..572ecd2 100644 --- a/dns/neonetwork +++ b/dns/neonetwork @@ -1,88 +1,87 @@ ; NeoNetwork DNS Record - -$TTL 604800 -@ IN SOA NeoPDP-11.neo. root.neo. ( +$TTL 3600 +@ IN SOA root-dns.neo. root.neo. ( 4096 ; Serial - 604800 ; Refresh - 86400 ; Retry - 2419200 ; Expire - 604800 ) ; Negative Cache TTL + 900 ; Refresh + 900 ; Retry + 86400 ; Expire + 900 ) ; Negative Cache TTL ; ; NeoNetwork Original -@ IN NS NeoPDP-11.neo. -@ IN A 10.127.1.1 -root IN CNAME neo. -NeoPDP-11 IN A 10.127.255.1 -caasih IN A 10.127.2.16 -NeoVAX IN A 10.127.2.22 -NeoSystem IN A 10.127.255.80 -neostorage IN A 10.127.1.10 -NeoBOX IN A 10.127.1.20 -cklvax IN A 10.127.1.40 -pan IN A 10.127.3.1 -NeoRouter IN A 10.127.2.127 -santost12 IN A 10.127.39.1 +@ IN NS NeoPDP-11.neo. +@ IN A 10.127.1.1 +root IN CNAME neo. +NeoPDP-11 IN A 10.127.255.1 +caasih IN A 10.127.2.16 +NeoVAX IN A 10.127.2.22 +NeoSystem IN A 10.127.255.80 +neostorage IN A 10.127.1.10 +NeoBOX IN A 10.127.1.20 +cklvax IN A 10.127.1.40 +pan IN A 10.127.3.1 +NeoRouter IN A 10.127.2.127 +santost12 IN A 10.127.39.1 -neko IN TXT "helloworld" -telegram IN TXT "https://t.me/NeoNetworkVPN" -root-dns IN A 10.127.255.53 -root-dns IN AAAA fd10:127:ffff:53:: -dns IN A 10.127.255.54 -dns IN AAAA fd10:127:53:53:: +neko IN TXT "helloworld" +telegram IN TXT "https://t.me/NeoNetworkVPN" +root-dns IN A 10.127.255.53 +root-dns IN AAAA fd10:127:ffff:53:: +dns IN A 10.127.255.54 +dns IN AAAA fd10:127:53:53:: -edwardp IN A 10.127.8.130 -edwardp IN AAAA fd10:127:2f2f:: +edwardp IN A 10.127.8.130 +edwardp IN AAAA fd10:127:2f2f:: ; DELEGATED ZONES -jerry IN NS ns1.jerry -jerry IN NS ns2.jerry -ns1.jerry IN A 10.127.8.193 -ns1.jerry IN AAAA fd10:127:53::1 -ns2.jerry IN A 10.127.8.216 -ns2.jerry IN AAAA fd10:127:53:100::1 +jerry IN NS ns1.jerry +jerry IN NS ns2.jerry +ns1.jerry IN A 10.127.8.193 +ns1.jerry IN AAAA fd10:127:53::1 +ns2.jerry IN A 10.127.8.216 +ns2.jerry IN AAAA fd10:127:53:100::1 -kp IN NS ns1.kp -ns1.kp IN A 10.127.39.1 -ns1.kp IN AAAA fd10:127:ec39:2222::1 +kp IN NS ns1.kp +ns1.kp IN A 10.127.39.1 +ns1.kp IN AAAA fd10:127:ec39:2222::1 -tracker IN NS ns1.tracker -ns1.tracker IN A 10.127.39.1 -ns1.tracker IN AAAA fd10:127:ec39:2222::1 +tracker IN NS ns1.tracker +ns1.tracker IN A 10.127.39.1 +ns1.tracker IN AAAA fd10:127:ec39:2222::1 -lantian IN NS ns-anycast.lantian -lantian IN NS ns1.lantian -lantian IN NS ns2.lantian -lantian IN NS ns3.lantian -lantian IN NS ns4.lantian -lantian IN NS ns5.lantian -ns-anycast.lantian IN A 10.127.10.254 -ns-anycast.lantian IN AAAA fd10:127:10:2547::54 -ns1.lantian IN A 10.127.10.1 -ns1.lantian IN AAAA fd10:127:10:1::1 -ns2.lantian IN A 10.127.10.3 -ns2.lantian IN AAAA fd10:127:10:3::1 -ns3.lantian IN A 10.127.10.8 -ns3.lantian IN AAAA fd10:127:10:8::1 -ns4.lantian IN A 10.127.10.2 -ns4.lantian IN AAAA fd10:127:10:2::1 -ns5.lantian IN A 10.127.10.9 -ns5.lantian IN AAAA fd10:127:10:9::1 +lantian IN NS ns-anycast.lantian +lantian IN NS ns1.lantian +lantian IN NS ns2.lantian +lantian IN NS ns3.lantian +lantian IN NS ns4.lantian +lantian IN NS ns5.lantian +ns-anycast.lantian IN A 10.127.10.254 +ns-anycast.lantian IN AAAA fd10:127:10:2547::54 +ns1.lantian IN A 10.127.10.1 +ns1.lantian IN AAAA fd10:127:10:1::1 +ns2.lantian IN A 10.127.10.3 +ns2.lantian IN AAAA fd10:127:10:3::1 +ns3.lantian IN A 10.127.10.8 +ns3.lantian IN AAAA fd10:127:10:8::1 +ns4.lantian IN A 10.127.10.2 +ns4.lantian IN AAAA fd10:127:10:2::1 +ns5.lantian IN A 10.127.10.9 +ns5.lantian IN AAAA fd10:127:10:9::1 -iedon IN NS ns.iedon -ns.iedon IN A 10.127.21.1 +iedon IN NS ns.iedon +ns.iedon IN A 10.127.21.1 -staph IN NS ns1.staph -staph IN NS ns2.staph -staph IN DS 64592 13 2 1AF24492D8FAE84D99E05C9B9088DDB8A82003F3301A53F35EFEC1627BEADDBA -ns1.staph IN A 10.127.8.185 -ns1.staph IN AAAA fd10:127:7::1 -ns2.staph IN A 10.127.8.190 -ns2.staph IN AAAA fd10:127:7::6 -aoscnet IN NS ns1.aoscnet -aoscnet IN NS ns2.aoscnet -aoscnet IN DS 27134 13 2 57145BCB903E0F0060BF94AA4EE5894DCA19D64E6B455A1C1864DA0FD4BA64E2 -ns1.aoscnet IN A 10.127.7.251 -ns1.aoscnet IN AAAA fd10:127:7:2672::1:1 -ns2.aoscnet IN A 10.127.7.252 -ns2.aoscnet IN AAAA fd10:127:7:2672::1:3 +staph IN NS ns1.staph +staph IN NS ns2.staph +staph IN DS 64592 13 2 1AF24492D8FAE84D99E05C9B9088DDB8A82003F3301A53F35EFEC1627BEADDBA +ns1.staph IN A 10.127.8.185 +ns1.staph IN AAAA fd10:127:7::1 +ns2.staph IN A 10.127.8.190 +ns2.staph IN AAAA fd10:127:7::6 +aoscnet IN NS ns1.aoscnet +aoscnet IN NS ns2.aoscnet +aoscnet IN DS 27134 13 2 57145BCB903E0F0060BF94AA4EE5894DCA19D64E6B455A1C1864DA0FD4BA64E2 +ns1.aoscnet IN A 10.127.7.251 +ns1.aoscnet IN AAAA fd10:127:7:2672::1:1 +ns2.aoscnet IN A 10.127.7.252 +ns2.aoscnet IN AAAA fd10:127:7:2672::1:3 diff --git a/scripts/check-named-zones.sh b/scripts/check-named-zones.sh index e2789ea..f4a9248 100755 --- a/scripts/check-named-zones.sh +++ b/scripts/check-named-zones.sh @@ -13,7 +13,7 @@ install() { install || { sudo apt update -qq; install; } check() { - PATH=/sbin:/usr/sbin:$PATH named-checkzone -i local $@ + PATH=/sbin:/usr/sbin:$PATH named-checkzone -i local -l 86400 $@ } pushd dns diff --git a/scripts/named-formatzone.py b/scripts/named-formatzone.py new file mode 100644 index 0000000..a4ec807 --- /dev/null +++ b/scripts/named-formatzone.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python3 + +# highly explosive + +import argparse +from pathlib import Path + +if __name__ == "__main__": + parser = argparse.ArgumentParser('named-formatzone') + parser.add_argument("file") + args = parser.parse_args() + zonefile = Path(args.file) + zonelines = zonefile.read_text().split('\n') + formatted = list() + max_length = [0, 0, 0, 0, 0] + in_soa = False + + def iter_lines(scan_only=True): + soafound = None + for rline in zonelines: + line, *comments = rline.split(';') + comments = ";".join(comments) + line = line.strip() + if "SOA" in line and soafound is None: + soafound = True + else: + if "IN" in line and soafound is True: + soafound = False + if soafound is False and line: + cols = line.split() + if len(cols) != 5: + cols.insert(1, "") + print(cols) + name, ttl, _in, rrtype, *record = cols + record = " ".join(record) + cols = (name, ttl, _in, rrtype, record) + assert _in == "IN" + if scan_only: + for i, entry in enumerate(cols): + max_length[i] = max(max_length[i], len(entry)) + else: + fmtlline = list() + for i, entry in enumerate(cols): + entry += " "*(max_length[i]-len(entry)+3) + if entry: + fmtlline.append(entry) + fmtline = " ".join(fmtlline) + formatted.append(f"{fmtline} ;{comments}" if comments else fmtline) + formatted[-1] = formatted[-1].strip() + else: + if not scan_only: + formatted.append(rline) + iter_lines() + iter_lines(False) + + zonefile.write_text("\n".join(formatted))