diff --git a/asn/AS4201270012.toml b/asn/AS4201270012.toml index 08eda8f..943cbc5 100644 --- a/asn/AS4201270012.toml +++ b/asn/AS4201270012.toml @@ -1,2 +1,2 @@ -name = "Yhi Interconnect" +name = "Yhi Interconnection" owner = "Junde Yhi" diff --git a/asn/AS4201270017.toml b/asn/AS4201270017.toml index aac9f4c..495017d 100644 --- a/asn/AS4201270017.toml +++ b/asn/AS4201270017.toml @@ -1,3 +1,3 @@ name = "BAOSHUO-AS-NEO" owner = "Ren Baoshuo" -description = "Baoshuo Network" \ No newline at end of file +description = "Baoshuo Neo Network" diff --git a/asn/AS4201270030.toml b/asn/AS4201270030.toml new file mode 100644 index 0000000..432339f --- /dev/null +++ b/asn/AS4201270030.toml @@ -0,0 +1,4 @@ +name = "IWARP-NEO" +owner = "Yux" +desc = "IWARP Global Experimental NeoNetwork" + diff --git a/asn/AS4201270099.toml b/asn/AS4201270099.toml new file mode 100644 index 0000000..c7696e5 --- /dev/null +++ b/asn/AS4201270099.toml @@ -0,0 +1,3 @@ +name = "AS-NEO-TSINGYAO" +owner = "TsingYao" +description = "TsingYao Neo Network" diff --git a/asn/AS4201271111.toml b/asn/AS4201271111.toml new file mode 100644 index 0000000..201908c --- /dev/null +++ b/asn/AS4201271111.toml @@ -0,0 +1,3 @@ +name = "kskb" +owner = "kskb" +desc = "kskb's network" diff --git a/asn/AS4201271488.toml b/asn/AS4201271488.toml new file mode 100644 index 0000000..33d550f --- /dev/null +++ b/asn/AS4201271488.toml @@ -0,0 +1,2 @@ +name = "Polar Bear" +owner = "SyllaBear" diff --git a/asn/AS4201272526.toml b/asn/AS4201272526.toml new file mode 100644 index 0000000..542a8cf --- /dev/null +++ b/asn/AS4201272526.toml @@ -0,0 +1,3 @@ +name = "ANILLC-AS-NEO" +owner = "Anillc" +description = "Anillc NEO Network" diff --git a/asn/AS4201279999.toml b/asn/AS4201279999.toml new file mode 100644 index 0000000..ff58c11 --- /dev/null +++ b/asn/AS4201279999.toml @@ -0,0 +1,2 @@ +name = "Hydro-Neo-Network" +owner = "undefined-moe" diff --git a/asn/AS4242420288.toml b/asn/AS4242420288.toml new file mode 100644 index 0000000..535e9de --- /dev/null +++ b/asn/AS4242420288.toml @@ -0,0 +1,3 @@ +name = "IWARP-DN42" +owner = "Yux" +desc = "IWARP DN42 Network" diff --git a/asn/AS4242421331.toml b/asn/AS4242421331.toml new file mode 100644 index 0000000..cdf3050 --- /dev/null +++ b/asn/AS4242421331.toml @@ -0,0 +1,3 @@ +name = "Niantic Network" +owner = "Yukari" +description = "Niantic Network Backbone" diff --git a/asn/AS4242421332.toml b/asn/AS4242421332.toml new file mode 100644 index 0000000..97f9e5b --- /dev/null +++ b/asn/AS4242421332.toml @@ -0,0 +1,3 @@ +name = "Niantic Network CN" +owner = "Yukari" +description = "Niantic Network China" diff --git a/asn/AS4242423699.toml b/asn/AS4242423699.toml new file mode 100644 index 0000000..c7696e5 --- /dev/null +++ b/asn/AS4242423699.toml @@ -0,0 +1,3 @@ +name = "AS-NEO-TSINGYAO" +owner = "TsingYao" +description = "TsingYao Neo Network" diff --git a/dns/db.10.127 b/dns/db.10.127 index 005b171..6a59598 100644 --- a/dns/db.10.127 +++ b/dns/db.10.127 @@ -34,13 +34,20 @@ $TTL 3600 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. +17.14 IN PTR gr-0-1-0-4.cr2.hkg1.licson.neo. +18.14 IN PTR yuetan.gr-0-1-0-4.cr2.hkg1.licson.neo. +21.14 IN PTR gr-0-1-0-5.cr2.hkg1.licson.neo. +22.14 IN PTR moecast.gr-0-1-0-5.cr2.hkg1.licson.neo. 1.15 IN PTR ae-0-1.cr2.hkg1.licson.neo. +58.15 IN PTR live.licson.neo. 1.8 IN PTR librehs.neo. 2.8 IN PTR blog.librehs.neo. 130.8 IN PTR edwardp.neo. +137.8 IN PTR lily.neo. + ; Loopback Addresses 1.255 IN PTR NeoPDP-11.neo. @@ -80,9 +87,14 @@ $TTL 3600 21 IN NS ns.iedon.neo. +30 IN NS ns1.iwarp.neo. + 127 IN NS ns1.yura.dn42. 127 IN NS ns2.yura.dn42. 66 IN NS ns1.fixmix.neo. 66 IN NS ns2.fixmix.neo. 66 IN NS ns3.fixmix.neo. + +99 IN NS ns1.tsingyao.neo. +99 IN NS ns2.tsingyao.neo. diff --git a/dns/db.fd10.127 b/dns/db.fd10.127 index 490e83e..d070010 100644 --- a/dns/db.fd10.127 +++ b/dns/db.fd10.127 @@ -13,6 +13,8 @@ $TTL 3600 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. +7.3.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.e.7.a.b IN PTR lily.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. @@ -33,6 +35,8 @@ $TTL 3600 0.1.0.0 IN DS 11807 13 2 BBADC27B4EBFC90CBA79F4E69E4F167B9FFAF664B071F4CC46196902054B0910 0.1.0.0 IN DS 11807 13 4 CB48D8BABA0E44B9D363D3142463014EBDE6D28E15997EA8FB5FDBD42FDCF1CF3846E63925A5910DDD6A192571AEBD93 +0.3.0.0 IN NS ns1.iwarp.neo. + 7.0.0.0 IN NS ns1.staph.neo. 7.2.1.0 IN NS ns1.yura.dn42. @@ -44,4 +48,9 @@ $TTL 3600 6.6.a.a IN NS ns2.fixmix.neo. 6.6.a.a IN NS ns3.fixmix.neo. +8.8.4.1 IN NS ns1.bear.neo. + c.c.0.0 IN NS ns1.an.dn42. + +9.9.0.0 IN NS ns1.tsingyao.neo. +9.9.0.0 IN NS ns2.tsingyao.neo. diff --git a/dns/neonetwork b/dns/neonetwork index 224a7c5..c800aeb 100644 --- a/dns/neonetwork +++ b/dns/neonetwork @@ -35,6 +35,11 @@ acme IN AAAA fd10:127:53:223::1 edwardp IN A 10.127.8.130 edwardp IN AAAA fd10:127:2f2f:: +tv IN A 10.127.15.58 + +lily IN A 10.127.8.137 +lily IN AAAA fd10:127:ba7e::137 + ; DELEGATED ZONES jerry IN NS ns1.jerry jerry IN NS ns2.jerry @@ -119,4 +124,32 @@ ns1.fixmix IN AAAA fd10:127:aa66:11:: ns2.fixmix IN AAAA fd10:127:aa66:21:: ns3.fixmix IN AAAA fd10:127:aa66:31:: +bear IN NS ns1.bear +koala IN NS ns1.bear +ns1.bear IN AAAA fd42:e621::53 + +iwarp IN NS ns1.iwarp +go IN NS ns1.iwarp +yux IN NS ns1.iwarp +ns1.iwarp IN A 10.127.30.53 +ns1.iwarp IN AAAA fd10:127:30:53::1 + an IN NS ns1.an.dn42. + +dnswol IN NS ns1.dnswol +dnswol IN NS ns2.dnswol +dnswol IN DS 53285 14 1 88971c954d18aa1224a1b01e54c81dc6cd71a86e +dnswol IN DS 53285 14 2 d782d7d9afec4e20082913fe2f23fd9e2c0e0ad7206fa389cadc4050d11b7e80 +dnswol IN DS 53285 14 4 1c0fcf050b4000de0648a8e25a8e809e35b7501c846ad785f07e2c4296610c305d217cb5113c34f937f62780e82b5e98 +ns1.dnswol IN A 10.127.99.50 +ns1.dnswol IN AAAA fd10:127:99::32:1 +ns2.dnswol IN A 10.127.99.51 +ns2.dnswol IN AAAA fd10:127:99::33:1 + +tsingyao IN NS ns1.dnswol +tsingyao IN NS ns2.dnswol + +undefiend.moe IN A 10.127.88.1 +*.undefined.moe IN A 10.127.88.1 +undefiend.moe IN AAAA fd10:127:88::1 +*.undefined.moe IN AAAA fd10:127:88::1 diff --git a/entity/Anillc.toml b/entity/Anillc.toml index 46ff946..662b683 100644 --- a/entity/Anillc.toml +++ b/entity/Anillc.toml @@ -5,4 +5,4 @@ email = "noc@anillc.cn" github = "Anillc" [persona] -pgp = "DCD75832819A6CAB61C8F7D337F54FEE22679910" +pgp = "BB47FA42A55975F74AE19EF8918F98A096F9533C" diff --git a/entity/JerryXiao.toml b/entity/JerryXiao.toml index e926f0c..269f5be 100644 --- a/entity/JerryXiao.toml +++ b/entity/JerryXiao.toml @@ -7,4 +7,4 @@ irc = "JerryXiao@hackint" github = "isjerryxiao" [persona] -pgp = "186242204A2EC70438E9CE3B9D9CE43650FF2BAA" +pgp = "5FC9AD5B960AD6F626E218DD22618F758B5BE2E5" diff --git a/entity/Junde Yhi.toml b/entity/Junde Yhi.toml index ec221d3..c9f6250 100644 --- a/entity/Junde Yhi.toml +++ b/entity/Junde Yhi.toml @@ -11,7 +11,7 @@ babel = [ ] [contact] -email = "lmy441900@live.com" +email = "neonetwork@yhi.moe" telegram = "lmy441900" mastodon = "@lmy441900@sn.angry.im" github = "lmy441900" diff --git a/entity/SyllaBear.toml b/entity/SyllaBear.toml new file mode 100644 index 0000000..9e62424 --- /dev/null +++ b/entity/SyllaBear.toml @@ -0,0 +1,8 @@ +name = "SyllaBear" + +[contact] +email = "bear@koala.gq" +github = "bearsylla" + +[persona] +pgp = "F5EC83B433A35C8CDF5B66568FBCE429B9AB90F4" diff --git a/entity/TsingYao.toml b/entity/TsingYao.toml new file mode 100644 index 0000000..3101203 --- /dev/null +++ b/entity/TsingYao.toml @@ -0,0 +1,10 @@ +name = "TsingYao" +babel = ["zh-N", "en"] + +[contact] +email = "yujintong@126.com" +telegram = "yujintong" +github = "yujintong" + +[persona] +pgp = "DD515D58188FBD2F9AF484F8AD04D02E24AC52C9" diff --git a/entity/Yukari.toml b/entity/Yukari.toml index 2305386..9d43e73 100644 --- a/entity/Yukari.toml +++ b/entity/Yukari.toml @@ -2,5 +2,8 @@ name = "Yukari" [contact] telegram = "CharlesYang" -github = "SteveCharlesYang" -email = "charles@0x7f.cc" +github = "YukariChiba" +email = "i@0x7f.cc" + +[persona] +pgp = "9DC663829861B7FDFB5DA8B39277CB21961D6DD5" diff --git a/entity/Yux.toml b/entity/Yux.toml new file mode 100644 index 0000000..e6fb2fd --- /dev/null +++ b/entity/Yux.toml @@ -0,0 +1,11 @@ +name = "Yux Zhu" + +[contact] +email = "me@yux.im" +telegram = "im_yux" +github = "vfreex" +irc = "yux@hackint" + +[persona] +pgp = "C1907229F1A6887550AD90A51ECBCCF8B5D891FD" + diff --git a/entity/kskb.toml b/entity/kskb.toml new file mode 100644 index 0000000..5bb5daf --- /dev/null +++ b/entity/kskb.toml @@ -0,0 +1,19 @@ +name = "kskb" +babel = [ + "zh", + "en-3", +] + +[contact] +email = "dn42@kskb.eu.org" +irc = "kskb" +telegram = "KusakabeSi" +mastodon = "" +github = "KusakabeSi" + +# Details on identifying the entity online (optional). Usually, a PGP key +# fingerprint can be put here to help others communicate with the entity more +# securely. +[persona] +pgp = "716846E71E56F088BDF42E695A6761FECF4CAA65" + diff --git a/entity/licson.toml b/entity/licson.toml index e0953cf..af31f26 100644 --- a/entity/licson.toml +++ b/entity/licson.toml @@ -3,4 +3,4 @@ name = "licson" [contact] email = "admin@licson.net" telegram = "licson" -github = "licson0729" +github = "licson" diff --git a/entity/undefined-moe.toml b/entity/undefined-moe.toml new file mode 100644 index 0000000..12f9ea1 --- /dev/null +++ b/entity/undefined-moe.toml @@ -0,0 +1,7 @@ +name = "undefined-moe" +babel = ["zh", "en-3"] + +[contact] +email = "i@undefined.moe" +telegram = "webpack_exports_undefined" +github = "undefined-moe" diff --git a/node/IWarp.toml b/node/IWarp.toml new file mode 100644 index 0000000..ec7fa17 --- /dev/null +++ b/node/IWarp.toml @@ -0,0 +1,2 @@ +[IWarp] +asn = 4201270030 diff --git a/node/TsingYao.toml b/node/TsingYao.toml new file mode 100644 index 0000000..a4a45f5 --- /dev/null +++ b/node/TsingYao.toml @@ -0,0 +1,3 @@ +[TsingYao] +asn = 4201270099 +description = "TsingYao Interconnection Region Edge Router" diff --git a/node/Yukari.toml b/node/Yukari.toml index 14ac120..3cf0405 100644 --- a/node/Yukari.toml +++ b/node/Yukari.toml @@ -1,3 +1,9 @@ [IX42-LAS] asn = 207268 cidr = ["10.127.131.0/24", "fd10:127:1300::/48"] + +[NIA-NET] +asn = 4242421331 + +[NIACN-NET] +asn = 4242421332 diff --git a/node/kskb.toml b/node/kskb.toml new file mode 100644 index 0000000..b96e996 --- /dev/null +++ b/node/kskb.toml @@ -0,0 +1,2 @@ +[KSKB-HK1] +asn = 4201271111 diff --git a/node/yhi-h.toml b/node/yhi-h.toml deleted file mode 100644 index 77c68bd..0000000 --- a/node/yhi-h.toml +++ /dev/null @@ -1,2 +0,0 @@ -[yhi-h] -asn = 4201270012 diff --git a/node/yhi.toml b/node/yhi.toml new file mode 100644 index 0000000..b4d01f3 --- /dev/null +++ b/node/yhi.toml @@ -0,0 +1,9 @@ +[yhi-h] +asn = 4201270012 +description = "Yhi Interconnection Region H Edge Router" +cidr = ["10.127.5.1/28"] + +[yhi-s] +asn = 4201270012 +description = "Yhi Interconnection Region S Edge Router" +cidr = ["10.127.5.17/28"] diff --git a/route/AS141776.toml b/route/AS141776.toml index fb1b8ca..055c4ac 100644 --- a/route/AS141776.toml +++ b/route/AS141776.toml @@ -1,9 +1,9 @@ -["10.127.60.0/24"] +["10.127.17.0/24"] type = "subnet" name = "BAOSHUO-NEO-V4-1" description = "Baoshuo Neo Network" -["fd10:127:9898::/48"] +["fd10:127:17::/48"] type = "subnet" name = "BAOSHUO-NEO-V6-1" description = "Baoshuo Neo Network" diff --git a/route/AS4201270000.toml b/route/AS4201270000.toml index 47c8f1c..c2af31c 100644 --- a/route/AS4201270000.toml +++ b/route/AS4201270000.toml @@ -5,33 +5,23 @@ description = "Reserved" ["10.127.1.0/24"] type = "subnet" -name = "CROOM" -description = "LAN at school" +name = "MAIN" +description = "LAN 1" ["10.127.2.0/24"] type = "subnet" -name = "NeoSystem" +name = "Messed-up Network" ["10.127.16.0/24"] type = "subnet" name = "Neo_Chen ZeroTier-One Hub" description = "" -["10.127.255.1/32"] -type = "loopback" -name = "NeoPDP-11" -description = "FreeBSD/frr" - ["10.127.255.4/32"] type = "loopback" name = "fsnvax" description = "Debian/frr" -["10.127.255.80/32"] -type = "loopback" -name = "NeoSystem" -description = "Arch Linux/frr" - ["fd10:127:5f37:59df::/64"] type = "subnet" name = "NeoNetwork Origin" diff --git a/route/AS4201270012.toml b/route/AS4201270012.toml index 48f4f77..23223a0 100644 --- a/route/AS4201270012.toml +++ b/route/AS4201270012.toml @@ -1,4 +1,9 @@ ["10.127.5.0/28"] type = "subnet" name = "yhi-h" -description = "Yhi Interconnect H" +description = "Yhi Interconnection Region H" + +["10.127.5.16/28"] +type = "subnet" +name = "yhi-s" +description = "Yhi Interconnection Region S" diff --git a/route/AS4201270017.toml b/route/AS4201270017.toml index fb1b8ca..055c4ac 100644 --- a/route/AS4201270017.toml +++ b/route/AS4201270017.toml @@ -1,9 +1,9 @@ -["10.127.60.0/24"] +["10.127.17.0/24"] type = "subnet" name = "BAOSHUO-NEO-V4-1" description = "Baoshuo Neo Network" -["fd10:127:9898::/48"] +["fd10:127:17::/48"] type = "subnet" name = "BAOSHUO-NEO-V6-1" description = "Baoshuo Neo Network" diff --git a/route/AS4201270030.toml b/route/AS4201270030.toml new file mode 100644 index 0000000..85ce7b0 --- /dev/null +++ b/route/AS4201270030.toml @@ -0,0 +1,10 @@ +["10.127.30.0/24"] +type = "subnet" +name = "IWARP-NEO-IP4-NETWORK" +description = "IWarp Global Experimental NeoNetwork - IPv4" + +["fd10:127:30::/48"] +type = "subnet" +name = "IWARP-NEO-IP6-NETWORK" +description = "IWarp Global Experimental NeoNetwork - IPv6" + diff --git a/route/AS4201270099.toml b/route/AS4201270099.toml new file mode 100644 index 0000000..dc46e7e --- /dev/null +++ b/route/AS4201270099.toml @@ -0,0 +1,9 @@ +["10.127.99.0/24"] +type = "subnet" +name = "TSINTYAO-NEO-NET4" +description = "TsingYao Neo Network IPv4 Block" + +["fd10:127:99::/48"] +type = "subnet" +name = "TSINGYAO-NEO-NET6" +description = "TsingYao Neo Network IPv6 Block" diff --git a/route/AS4201271111.toml b/route/AS4201271111.toml new file mode 100644 index 0000000..d8577dc --- /dev/null +++ b/route/AS4201271111.toml @@ -0,0 +1,9 @@ +["10.127.111.0/24"] +type = "subnet" +name = "kskb" +description = "kskb" + +["fd10:127:e00f::/48"] +type = "subnet" +name = "kskb" +description = "kskb" diff --git a/route/AS4201271488.toml b/route/AS4201271488.toml new file mode 100644 index 0000000..1c7ece5 --- /dev/null +++ b/route/AS4201271488.toml @@ -0,0 +1,4 @@ +["fd10:127:1488::/48"] +type = "subnet" +name = "Bear" +description = "Bear Neo Network" diff --git a/route/AS4201272526.toml b/route/AS4201272526.toml new file mode 100644 index 0000000..a28a041 --- /dev/null +++ b/route/AS4201272526.toml @@ -0,0 +1,7 @@ +["10.127.3.0/24"] +type = "subnet" +name = "Anillc NEO Network v4" + +["fd10:127:ee::/48"] +type = "subnet" +name = "Anillc NEO Network v6" diff --git a/route/AS4201279999.toml b/route/AS4201279999.toml new file mode 100644 index 0000000..1ad18a8 --- /dev/null +++ b/route/AS4201279999.toml @@ -0,0 +1,8 @@ +["10.127.88.0/24"] +type = "subnet" +name = "Hydro-Neo-Network-4" + +["fd10:127:88::/48"] +type = "subnet" +name = "Hydro-Neo-Network-6" + diff --git a/route/AS4242420247.toml b/route/AS4242420247.toml index fb1b8ca..055c4ac 100644 --- a/route/AS4242420247.toml +++ b/route/AS4242420247.toml @@ -1,9 +1,9 @@ -["10.127.60.0/24"] +["10.127.17.0/24"] type = "subnet" name = "BAOSHUO-NEO-V4-1" description = "Baoshuo Neo Network" -["fd10:127:9898::/48"] +["fd10:127:17::/48"] type = "subnet" name = "BAOSHUO-NEO-V6-1" description = "Baoshuo Neo Network" diff --git a/route/AS4242420288.toml b/route/AS4242420288.toml new file mode 100644 index 0000000..74088bf --- /dev/null +++ b/route/AS4242420288.toml @@ -0,0 +1,9 @@ +["10.127.30.0/24"] +type = "subnet" +name = "IWARP-NEO-IP4-NETWORK" +description = "IWarp Global Experimental NeoNetwork - IPv4" + +["fd10:127:30::/48"] +type = "subnet" +name = "IWARP-NEO-IP6-NETWORK" +description = "IWarp Global Experimental NeoNetwork - IPv6" diff --git a/route/AS4242421332.toml b/route/AS4242421332.toml new file mode 100644 index 0000000..43c7df0 --- /dev/null +++ b/route/AS4242421332.toml @@ -0,0 +1,9 @@ +["10.127.132.0/24"] +type = "subnet" +name = "NetUnion-IPv4" +description = "NetUnion access. (IPv4)" + +["fd10:127:1332::/48"] +type = "subnet" +name = "NetUnion-IPv6" +description = "NetUnion access. (IPv6)" diff --git a/route/AS4242423699.toml b/route/AS4242423699.toml new file mode 100644 index 0000000..dc46e7e --- /dev/null +++ b/route/AS4242423699.toml @@ -0,0 +1,9 @@ +["10.127.99.0/24"] +type = "subnet" +name = "TSINTYAO-NEO-NET4" +description = "TsingYao Neo Network IPv4 Block" + +["fd10:127:99::/48"] +type = "subnet" +name = "TSINGYAO-NEO-NET6" +description = "TsingYao Neo Network IPv6 Block" diff --git a/scripts/dns-generator.py b/scripts/dns-generator.py index 444fc4e..95e41c9 100755 --- a/scripts/dns-generator.py +++ b/scripts/dns-generator.py @@ -3,28 +3,42 @@ import sys from pathlib import Path import toml -from rfc2317 import gen_reverse_pointers -RESOLVE_FILE = Path("dns", "db.10.127") +from rfc2317 import gen_reverse_pointers, ZONE as RFC2317_ZONE +from roa import export_dnssec_dnskey + +ZONE_FILE_MAP = { + 'neo.': Path("dns", "neonetwork"), + '127.10.in-addr.arpa.': Path("dns", "db.10.127"), + '7.2.1.0.0.1.d.f.ip6.arpa.': Path("dns", "db.fd10.127") +} RFC2317_FILE = Path("dns", "rfc2317.toml") + def iter_rfc2317_entry(): entries = toml.loads(RFC2317_FILE.read_text()) for (route, attributes) in entries.items(): - ns = attributes.get('NS') - ds = attributes.get('DS', list()) - ttl = attributes.get('TTL', -1) - yield(route, ns, ds, ttl) + ns = attributes.get("NS") + ds = attributes.get("DS", list()) + ttl = attributes.get("TTL", -1) + yield (route, ns, ds, ttl) + def main(): - orignal = RESOLVE_FILE.read_text() - records = [orignal, "; AUTOGENERATED"] - records.extend(("", "; rfc2317")) - for route, ns, ds, ttl in iter_rfc2317_entry(): - records.extend(gen_reverse_pointers(route, ns, ds, ttl)) + DNSKEYS = {entry['zone']: entry['records'] for entry in export_dnssec_dnskey()} + for zone, zone_file in ZONE_FILE_MAP.items(): + orignal = zone_file.read_text() + records = [orignal, "; AUTOGENERATED"] + if zone.strip('.') == RFC2317_ZONE.strip('.'): + records.extend(("", "; rfc2317")) + for route, ns, ds, ttl in iter_rfc2317_entry(): + records.extend(gen_reverse_pointers(route, ns, ds, ttl)) + records.append("") + records.extend(("", "; dnskey")) + for key_ds in DNSKEYS[zone]: + records.append(f"@ IN DNSKEY {key_ds['dnskey']}") records.append("") - - RESOLVE_FILE.write_text("\n".join(records)) + zone_file.write_text("\n".join(records)) if __name__ == "__main__": diff --git a/scripts/named-formatzone.py b/scripts/named-formatzone.py index a4ec807..2aa2afc 100644 --- a/scripts/named-formatzone.py +++ b/scripts/named-formatzone.py @@ -6,11 +6,11 @@ import argparse from pathlib import Path if __name__ == "__main__": - parser = argparse.ArgumentParser('named-formatzone') + parser = argparse.ArgumentParser("named-formatzone") parser.add_argument("file") args = parser.parse_args() zonefile = Path(args.file) - zonelines = zonefile.read_text().split('\n') + zonelines = zonefile.read_text().split("\n") formatted = list() max_length = [0, 0, 0, 0, 0] in_soa = False @@ -18,7 +18,7 @@ if __name__ == "__main__": def iter_lines(scan_only=True): soafound = None for rline in zonelines: - line, *comments = rline.split(';') + line, *comments = rline.split(";") comments = ";".join(comments) line = line.strip() if "SOA" in line and soafound is None: @@ -41,7 +41,7 @@ if __name__ == "__main__": else: fmtlline = list() for i, entry in enumerate(cols): - entry += " "*(max_length[i]-len(entry)+3) + entry += " " * (max_length[i] - len(entry) + 3) if entry: fmtlline.append(entry) fmtline = " ".join(fmtlline) @@ -50,6 +50,7 @@ if __name__ == "__main__": else: if not scan_only: formatted.append(rline) + iter_lines() iter_lines(False) diff --git a/scripts/rfc2317.py b/scripts/rfc2317.py index d9badff..1d56694 100755 --- a/scripts/rfc2317.py +++ b/scripts/rfc2317.py @@ -2,12 +2,15 @@ import ipaddress -ZONE = '.127.10.in-addr.arpa' +ZONE = ".127.10.in-addr.arpa" + + def truncate(rev: str) -> str: assert rev.endswith(ZONE) - rev = rev[:-len(ZONE)] + rev = rev[: -len(ZONE)] return rev + def gen_reverse_pointers(network: str, ns: list, ds: list = [], ttl: int = -1) -> list: ttl = f"{ttl} " if 900 <= ttl <= 86400 else "" buf = list() @@ -25,5 +28,17 @@ def gen_reverse_pointers(network: str, ns: list, ds: list = [], ttl: int = -1) - buf.append(f"{cnamefr} {ttl}IN CNAME {cnameto}") return buf + if __name__ == "__main__": - print("\n".join(gen_reverse_pointers('10.127.8.64/26', ['ns1.jerry.neo.'], ['18792 13 2 2F335456EEE70FC4833886E5EEDC28E7195E90E2A337860B3E805D5EB9F3A804'], ttl=1500))) + print( + "\n".join( + gen_reverse_pointers( + "10.127.8.64/26", + ["ns1.jerry.neo."], + [ + "18792 13 2 2F335456EEE70FC4833886E5EEDC28E7195E90E2A337860B3E805D5EB9F3A804" + ], + ttl=1500, + ) + ) + ) diff --git a/scripts/roa.py b/scripts/roa.py index 69b6e92..d3f2be7 100755 --- a/scripts/roa.py +++ b/scripts/roa.py @@ -3,8 +3,12 @@ import argparse import json import re import time + +# dnssec +from base64 import b64decode from collections import defaultdict from contextlib import redirect_stdout +from functools import wraps from io import StringIO from ipaddress import IPv4Network, IPv6Network, ip_network from itertools import combinations @@ -12,12 +16,9 @@ from pathlib import Path import netaddr import toml -from tabulate import tabulate -# dnssec -from base64 import b64decode from dns.dnssec import make_ds from dns.rdtypes.ANY.DNSKEY import DNSKEY - +from tabulate import tabulate NEO_NETWORK_POOL = [ip_network("10.127.0.0/16"), ip_network("fd10:127::/32")] @@ -62,11 +63,24 @@ def iter_toml_file(path: str): yield item, toml.loads(item.read_text()) +def _sort_as_iterator(func): + @wraps(func) + def wrapped(*args, **kwargs): + for item in sorted( + list(func(*args, **kwargs)), key=lambda x: x[0], reverse=False + ): + yield item + + return wrapped + + +@_sort_as_iterator def load_entities(): for item, entity in iter_toml_file("entity"): yield item.stem, entity +@_sort_as_iterator def load_asn(entities: dict): for item, entity in iter_toml_file("asn"): asn = int(item.stem.lstrip("AS")) @@ -133,7 +147,9 @@ def route_to_roa(asn_table: dict): try: assert net1["prefix"] != net2["prefix"] except AssertionError: - assert net1['asn'] != net2['asn'] and entity_from_net(net1) == entity_from_net(net2) + assert net1["asn"] != net2["asn"] and entity_from_net( + net1 + ) == entity_from_net(net2) continue assert net1["prefix"].supernet_of(net2["prefix"]) s1net, s2net = (net1["supernet"], net2["supernet"]) @@ -170,10 +186,19 @@ def prehandle_roa(asn_table: dict, args): r["prefix"] = r["prefix"].with_prefixlen return roa4, roa6 + def export_dnssec_dnskey(): def ds_from_dnskey(zone, flags, protocol, algorithm, *key): - dnspy_dnskey = DNSKEY("IN", "DNSKEY", int(flags), int(protocol), int(algorithm), b64decode(" ".join(key))) + dnspy_dnskey = DNSKEY( + "IN", + "DNSKEY", + int(flags), + int(protocol), + int(algorithm), + b64decode(" ".join(key)), + ) return make_ds(zone, dnspy_dnskey, "SHA256").to_text() + dnskey_path = Path("dns") / "dnssec" dnskeys = list() for f in dnskey_path.iterdir(): @@ -188,14 +213,17 @@ def export_dnssec_dnskey(): zonekey["zone"] = zone else: assert zonekey["zone"] == zone - zonekey["records"].append({ - "dnskey": " ".join(dnskey), - "ds": ds_from_dnskey(zone, *dnskey), - }) + zonekey["records"].append( + { + "dnskey": " ".join(dnskey), + "ds": ds_from_dnskey(zone, *dnskey), + } + ) if zonekey["zone"]: dnskeys.append(zonekey) return dnskeys + def make_export(roa4, roa6): def modify_entity(entity): entity["nic_hdl"] = name_to_nic_hdl(entity["name"]) @@ -234,7 +262,7 @@ def make_export(roa4, roa6): } for owner, entity in entities.items() }, - "dnssec": export_dnssec_dnskey() + "dnssec": export_dnssec_dnskey(), } return json.dumps(output, indent=2) @@ -263,7 +291,10 @@ def make_rfc8416(roa4, roa6): "bgpsecAssertions": [], "prefixAssertions": [ pick( - roa, ["asn", "prefix"], maxLength="maxPrefixLength", name="comment", + roa, + ["asn", "prefix"], + maxLength="maxPrefixLength", + name="comment", ) for roa in (*roa4, *roa6) ], @@ -371,19 +402,51 @@ def make_summary(): print(prefix) print("```") IP_VRSIONS = {4, 6} - total_ip_count = {ver: sum([prefix.num_addresses for prefix in NEO_NETWORK_POOL if prefix.version == ver]) for ver in IP_VRSIONS} - used_ip_count = {ver: sum([ip_network(str(prefix)).num_addresses for prefix in prefixes if prefix.version == ver]) for ver in IP_VRSIONS} + total_ip_count = { + ver: sum( + [ + prefix.num_addresses + for prefix in NEO_NETWORK_POOL + if prefix.version == ver + ] + ) + for ver in IP_VRSIONS + } + used_ip_count = { + ver: sum( + [ + ip_network(str(prefix)).num_addresses + for prefix in prefixes + if prefix.version == ver + ] + ) + for ver in IP_VRSIONS + } print() print("## Address Space Usage") print() address_space_usage_table = tabulate( ( - (f"IPv{ver}", f"{(t:=total_ip_count.get(ver)):.5g}", f"{(u:=used_ip_count.get(ver)):.5g}", f"{t-u:.5g}", f"{u/t*100:.2f}%", f"{(t-u)/t*100:.2f}%") + ( + f"IPv{ver}", + f"{(t:=total_ip_count.get(ver)):.5g}", + f"{(u:=used_ip_count.get(ver)):.5g}", + f"{t-u:.5g}", + f"{u/t*100:.2f}%", + f"{(t-u)/t*100:.2f}%", + ) for ver in IP_VRSIONS ), - headers=["IP Version", "Total", "Used", "Free", "Percent Used", "Percent Free"], + headers=[ + "IP Version", + "Total", + "Used", + "Free", + "Percent Used", + "Percent Free", + ], tablefmt="github", - disable_numparse=True + disable_numparse=True, ) print(address_space_usage_table) return stream.getvalue() diff --git a/scripts/update-zone-serial.py b/scripts/update-zone-serial.py index 7ee4aa9..8394e6a 100755 --- a/scripts/update-zone-serial.py +++ b/scripts/update-zone-serial.py @@ -1,23 +1,24 @@ #!/usr/bin/env python3 -from pathlib import Path import subprocess -from time import time -from re import match from os import chdir +from pathlib import Path +from re import match +from time import time zone_files = [ - 'neonetwork', - 'db.10.127', - 'db.fd10.127', + "neonetwork", + "db.10.127", + "db.fd10.127", ] serial_base = 1586876035 new_serial = int(time()) - serial_base + def update_serial_to(zone: Path, serial: int = 0) -> int: lines = zone.read_text().split("\n") processed = list() - assert 0 <= serial <= 2**32 + assert 0 <= serial <= 2 ** 32 found = False old_serial = None for line in lines: @@ -34,6 +35,7 @@ def update_serial_to(zone: Path, serial: int = 0) -> int: zone.write_text("\n".join(processed)) return old_serial + for zone in zone_files: gen_zone = Path("generated") / "dns" / zone repo_zone = Path("dns") / zone @@ -42,7 +44,9 @@ for zone in zone_files: old_serial = update_serial_to(gen_zone) update_serial_to(repo_zone, old_serial) gen_zone.write_text(repo_zone.read_text()) - p = subprocess.run(['git', 'diff', '--exit-code', gen_zone.name], cwd=gen_zone.parent) + p = subprocess.run( + ["git", "diff", "--exit-code", gen_zone.name], cwd=gen_zone.parent + ) if p.returncode == 0: print(f"skip {repo_zone.name}") else: