diff --git a/.github/workflows/roa.yml b/.github/workflows/roa.yml index 45b416e..731cc4a 100644 --- a/.github/workflows/roa.yml +++ b/.github/workflows/roa.yml @@ -22,19 +22,30 @@ jobs: run: | sudo apt update -qq sudo apt install -y python3 git openssh-client + sudo apt install -y curl + curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash + export PATH="$HOME/.pyenv/bin:$PATH" + eval "$(pyenv init -)" + eval "$(pyenv virtualenv-init -)" + pyenv install 3.8.2 + pyenv shell 3.8.2 - name: Run roa script shell: bash run: | + export PATH="$HOME/.pyenv/bin:$PATH" + eval "$(pyenv init -)" + eval "$(pyenv virtualenv-init -)" + pyenv shell 3.8.2 maxlen4=29 maxlen6=64 mkdir -p roa_dir - python3 scripts/roa.py -m ${maxlen4} -M ${maxlen6} -o roa_dir/roa46_bird2.conf - python3 scripts/roa.py -m ${maxlen4} -M ${maxlen6} -4 -o roa_dir/roa4_bird2.conf - python3 scripts/roa.py -m ${maxlen4} -M ${maxlen6} -6 -o roa_dir/roa6_bird2.conf - python3 scripts/roa.py -m ${maxlen4} -M ${maxlen6} -j -o roa_dir/roa46.json - python3 scripts/roa.py -m ${maxlen4} -M ${maxlen6} -e -o roa_dir/neonetwork.json - python3 scripts/roa.py -m ${maxlen4} -M ${maxlen6} -r -o roa_dir/rfc8416.json + pyenv exec python3 scripts/roa.py -m ${maxlen4} -M ${maxlen6} -o roa_dir/roa46_bird2.conf + pyenv exec python3 scripts/roa.py -m ${maxlen4} -M ${maxlen6} -4 -o roa_dir/roa4_bird2.conf + pyenv exec python3 scripts/roa.py -m ${maxlen4} -M ${maxlen6} -6 -o roa_dir/roa6_bird2.conf + pyenv exec python3 scripts/roa.py -m ${maxlen4} -M ${maxlen6} -j -o roa_dir/roa46.json + pyenv exec python3 scripts/roa.py -m ${maxlen4} -M ${maxlen6} -e -o roa_dir/neonetwork.json + pyenv exec python3 scripts/roa.py -m ${maxlen4} -M ${maxlen6} -r -o roa_dir/rfc8416.json - name: Upload files env: diff --git a/.github/workflows/test-your-pr.yml b/.github/workflows/test-your-pr.yml index a893b6a..0f1ff26 100644 --- a/.github/workflows/test-your-pr.yml +++ b/.github/workflows/test-your-pr.yml @@ -22,16 +22,27 @@ jobs: run: | sudo apt update -qq sudo apt install -y python3 git openssh-client + sudo apt install -y curl + curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash + export PATH="$HOME/.pyenv/bin:$PATH" + eval "$(pyenv init -)" + eval "$(pyenv virtualenv-init -)" + pyenv install 3.8.2 + pyenv shell 3.8.2 - name: Run roa script shell: bash run: | + export PATH="$HOME/.pyenv/bin:$PATH" + eval "$(pyenv init -)" + eval "$(pyenv virtualenv-init -)" + pyenv shell 3.8.2 maxlen4=29 maxlen6=64 mkdir -p roa_dir - python3 scripts/roa.py -m ${maxlen4} -M ${maxlen6} -o roa_dir/roa46_bird2.conf - python3 scripts/roa.py -m ${maxlen4} -M ${maxlen6} -4 -o roa_dir/roa4_bird2.conf - python3 scripts/roa.py -m ${maxlen4} -M ${maxlen6} -6 -o roa_dir/roa6_bird2.conf - python3 scripts/roa.py -m ${maxlen4} -M ${maxlen6} -j -o roa_dir/roa46.json - python3 scripts/roa.py -m ${maxlen4} -M ${maxlen6} -e -o roa_dir/neonetwork.json - python3 scripts/roa.py -m ${maxlen4} -M ${maxlen6} -r -o roa_dir/rfc8416.json + pyenv exec python3 scripts/roa.py -m ${maxlen4} -M ${maxlen6} -o roa_dir/roa46_bird2.conf + pyenv exec python3 scripts/roa.py -m ${maxlen4} -M ${maxlen6} -4 -o roa_dir/roa4_bird2.conf + pyenv exec python3 scripts/roa.py -m ${maxlen4} -M ${maxlen6} -6 -o roa_dir/roa6_bird2.conf + pyenv exec python3 scripts/roa.py -m ${maxlen4} -M ${maxlen6} -j -o roa_dir/roa46.json + pyenv exec python3 scripts/roa.py -m ${maxlen4} -M ${maxlen6} -e -o roa_dir/neonetwork.json + pyenv exec python3 scripts/roa.py -m ${maxlen4} -M ${maxlen6} -r -o roa_dir/rfc8416.json diff --git a/README.md b/README.md index 5b30d28..1889a7d 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,9 @@ # NeoNetwork A useless VPN network ready for peering! -**WARNING:** This network is not interconnected to DN42 yet +This network is connected with [DN42](https://dn42.net) Git Repo. [here](https://git.neocloud.tw) Pull requests are welcomed! Working language: `zh_* / en_*` -Telegram Group invitation link available at TXT record of `join-telegram.neocloud.tw` ## IXs @@ -27,11 +26,12 @@ Any protocol supported by Bird, Quagga or FRRouting, BGP recommended. All IPv4 addresses are under the range 10.127.0.0/16 All IPv6 addresses are under the range fd10:127::/32 -see routes.txt for allocated domain. +see [route](https://github.com/NeoCloud/NeoNetwork/tree/master/route) +and [route6](https://github.com/NeoCloud/NeoNetwork/tree/master/route6) for allocated subnet. ## DNS -There's a bind9 server on dns.neocloud.tw (10.127.225.2), all domain names are under ".neo". +There's a bind9 server on dns.neocloud.tw (`10.127.225.2` and `fd10:127:5f37:59df::255:2`), all domain names are under ".neo". ## Connection Graph @@ -44,5 +44,6 @@ There's a bind9 server on dns.neocloud.tw (10.127.225.2), all domain names are u entity/ Entitys route/ Network subnet allocation node/ Nodes + peer/ Peering status vpn/ VPN configuration examples (Tinc & WireGuard) dns/ Bind9 DNS zone files and example configuration diff --git a/asn/AS134098 b/asn/AS134098 new file mode 100644 index 0000000..815baf4 --- /dev/null +++ b/asn/AS134098 @@ -0,0 +1,4 @@ +NAME="Licson Internal Network" +OWNER="licson" +DESC="" +VALID="YES" diff --git a/asn/AS4201270012 b/asn/AS4201270012 new file mode 100644 index 0000000..b675043 --- /dev/null +++ b/asn/AS4201270012 @@ -0,0 +1,3 @@ +NAME="Yhi Interconnect" +OWNER="Junde Yhi" +DESC="" diff --git a/asn/AS4201270014 b/asn/AS4201270014 new file mode 100644 index 0000000..54ad6c3 --- /dev/null +++ b/asn/AS4201270014 @@ -0,0 +1,3 @@ +NAME="leedagee" +OWNER="leedagee" +DESC="" diff --git a/asn/AS4242420916 b/asn/AS4242420916 new file mode 100644 index 0000000..87bb8e9 --- /dev/null +++ b/asn/AS4242420916 @@ -0,0 +1,3 @@ +NAME="alanyhq" +OWNER="alanyhq" +DESC="alanyhq main" diff --git a/dns/db.10.127 b/dns/db.10.127 index 518adc7..8b2c0ea 100644 --- a/dns/db.10.127 +++ b/dns/db.10.127 @@ -17,6 +17,7 @@ $TTL 604800 10.1 IN PTR neostorage.neonetwork. 80.1 IN PTR NeoSystem.neo. 1.3 IN PTR pan.neo. +16.2 IN PTR caasih.neo. 185.8 IN PTR staph.neo. 187.8 IN PTR staph-cn.neo. diff --git a/dns/neonetwork b/dns/neonetwork index fb1fe9c..07ebb0f 100644 --- a/dns/neonetwork +++ b/dns/neonetwork @@ -15,13 +15,12 @@ $TTL 604800 root IN CNAME neo. NeoPDP-11 IN A 10.127.255.1 ucbvax IN A 10.127.255.2 -caasih IN A 10.127.0.1 +caasih IN A 10.127.2.16 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 NNPCC IN A 10.127.1.63 -NeoVAX IN A 10.127.0.38 pan IN A 10.127.3.1 staph IN A 10.127.8.185 staph-cn IN A 10.127.8.187 diff --git a/docs/index.html b/docs/index.html index 71b7580..981b97d 100644 --- a/docs/index.html +++ b/docs/index.html @@ -11,11 +11,10 @@

NeoNetwork

A useless VPN network ready for peering!
-WARNING: This network is not interconnected to DN42 yet
+This network is connected with DN42
Git Repo. here
Pull requests are welcomed!
-Working language: zh_* / en_*
-Telegram Group invitation link available at TXT record of join-telegram.neocloud.tw

+Working language: zh_* / en_*

IXs

@@ -33,17 +32,18 @@ megumi.yukipedia.cf (10.127.30.1, ASN 4242421037)

Routing Protocols

-

Any protocol supported by Quagga or FRRouting, recommended to use BGP.

+

Any protocol supported by Bird, Quagga or FRRouting, BGP recommended.

IP Addresses

All IPv4 addresses are under the range 10.127.0.0/16
All IPv6 addresses are under the range fd10:127::/32
-see routes.txt for allocated domain.

+see route +and route6 for allocated subnet.

DNS

-

There’s a bind9 server on dns.neocloud.tw (10.127.225.2), all domain names are under “.neo”.

+

There’s a bind9 server on dns.neocloud.tw (10.127.225.2 and fd10:127:5f37:59df::255:2), all domain names are under “.neo”.

Connection Graph

@@ -56,6 +56,7 @@ asn/ BGP AS Number allocation entity/ Entitys route/ Network subnet allocation node/ Nodes +peer/ Peering status vpn/ VPN configuration examples (Tinc & WireGuard) dns/ Bind9 DNS zone files and example configuration diff --git a/document/asn-dir.txt b/document/asn-dir.txt index 23f873e..2da5a95 100644 --- a/document/asn-dir.txt +++ b/document/asn-dir.txt @@ -8,3 +8,7 @@ NAME="" OWNER="" # Description DESC="" +# if it's a ASN registered from *NIC, this variable records +# whether members of NeoNetwork have validated its ownership yet +# possible value: "YES" "NO" +VALID="" diff --git a/document/entity-dir.txt b/document/entity-dir.txt index e03dc03..951a206 100644 --- a/document/entity-dir.txt +++ b/document/entity-dir.txt @@ -16,3 +16,5 @@ CONTACT=( BABEL=( "" ) +# OpenPGP key fingerprint +AUTH="PGP:" diff --git a/entity/Icecat b/entity/Icecat index 705a33f..f794757 100644 --- a/entity/Icecat +++ b/entity/Icecat @@ -10,3 +10,4 @@ CONTACT=( BABEL=( "" ) +AUTH="" diff --git a/entity/James58899 b/entity/James58899 index ba3d526..7c6219c 100644 --- a/entity/James58899 +++ b/entity/James58899 @@ -10,3 +10,4 @@ CONTACT=( BABEL=( "" ) +AUTH="" diff --git a/entity/JerryXiao b/entity/JerryXiao index 748f16c..45cb524 100644 --- a/entity/JerryXiao +++ b/entity/JerryXiao @@ -10,3 +10,4 @@ CONTACT=( BABEL=( "" ) +AUTH="PGP:186242204A2EC70438E9CE3B9D9CE43650FF2BAA" diff --git a/entity/Junde Yhi b/entity/Junde Yhi new file mode 100644 index 0000000..5b94a98 --- /dev/null +++ b/entity/Junde Yhi @@ -0,0 +1,19 @@ +NAME="Junde Yhi" +DESC="" +CONTACT=( + "EMAIL:lmy441900@live.com" + "TELEGRAM:@lmy441900" + "MASTODON:@lmy441900@sn.angry.im" + "GITHUB:lmy441900" +) +BABEL=( + "zh-N" + "zh-hans-N" + "zh-hant-2" + "en-3" + "de-0" + "ru-0" + "jp-0" + "fi-0" +) +AUTH="PGP:E6C74782A1FBEE741D09885FD274286F672C800A" diff --git a/entity/LINE-NZ b/entity/LINE-NZ index c9fef83..26eae7b 100644 --- a/entity/LINE-NZ +++ b/entity/LINE-NZ @@ -10,3 +10,4 @@ CONTACT=( BABEL=( "en" ) +AUTH="" diff --git a/entity/Lan Tian b/entity/Lan Tian index 56f794b..690f116 100644 --- a/entity/Lan Tian +++ b/entity/Lan Tian @@ -10,3 +10,4 @@ CONTACT=( BABEL=( "" ) +AUTH="" diff --git a/entity/LibreHouse b/entity/LibreHouse index 24b8479..ccbb13b 100644 --- a/entity/LibreHouse +++ b/entity/LibreHouse @@ -14,3 +14,4 @@ BABEL=( "en-2" "ja-0" ) +AUTH="" diff --git a/entity/Ndoskrnl b/entity/Ndoskrnl index 77bb01d..d178abe 100644 --- a/entity/Ndoskrnl +++ b/entity/Ndoskrnl @@ -10,3 +10,4 @@ CONTACT=( BABEL=( "zh|en-1" ) +AUTH="" diff --git a/entity/Neo_Chen b/entity/Neo_Chen index c9c9f87..518e662 100644 --- a/entity/Neo_Chen +++ b/entity/Neo_Chen @@ -11,3 +11,4 @@ BABEL=( "zh-N" "en-2" ) +AUTH="PGP:D306BB628837043150CD1E42CA0957540FD996CD" diff --git a/entity/SUNNET b/entity/SUNNET index cf6e1ad..df0d2d7 100644 --- a/entity/SUNNET +++ b/entity/SUNNET @@ -10,3 +10,4 @@ CONTACT=( BABEL=( "" ) +AUTH="" diff --git a/entity/Septs b/entity/Septs index a0e9cf0..fa76f99 100644 --- a/entity/Septs +++ b/entity/Septs @@ -10,3 +10,4 @@ CONTACT=( BABEL=( "" ) +AUTH="" diff --git a/entity/Staph b/entity/Staph index 44a98f9..5ef685a 100644 --- a/entity/Staph +++ b/entity/Staph @@ -8,5 +8,10 @@ CONTACT=( "GITHUB: StephDC" ) BABEL=( - "" + "zh-N" + "en-4" + "ja-2" + "es-1" + "fr-1" ) +AUTH="" diff --git a/entity/Yangfl b/entity/Yangfl index 67f9134..7d29678 100644 --- a/entity/Yangfl +++ b/entity/Yangfl @@ -10,3 +10,4 @@ CONTACT=( BABEL=( "" ) +AUTH="" diff --git a/entity/alanyhq b/entity/alanyhq new file mode 100644 index 0000000..ca1bf27 --- /dev/null +++ b/entity/alanyhq @@ -0,0 +1,14 @@ +NAME="alanyhq" +DESC="" +CONTACT=( + "EMAIL:" + "TELEGRAM:@alanyhq" + "IRC:alanyhq" + "MASTODON:" + "GITHUB:" +) +BABEL=( + "zh-N" + "en-2" +) +AUTH="" diff --git a/entity/chenx97 b/entity/chenx97 index de2ae20..e05de6d 100644 --- a/entity/chenx97 +++ b/entity/chenx97 @@ -10,3 +10,4 @@ CONTACT=( BABEL=( "" ) +AUTH="" diff --git a/entity/frank b/entity/frank index 0d0a89c..64d8408 100644 --- a/entity/frank +++ b/entity/frank @@ -10,3 +10,4 @@ CONTACT=( BABEL=( "" ) +AUTH="" diff --git a/entity/leedagee b/entity/leedagee new file mode 100644 index 0000000..9f3b587 --- /dev/null +++ b/entity/leedagee @@ -0,0 +1,13 @@ +NAME="leedagee" +DESC="" +CONTACT=( + "EMAIL:leedageea@gmail.com" + "TELEGRAM:@leedagee" + "IRC:lizr" + "GITHUB:leedagee" +) +BABEL=( + "zh-N" + "en-2" +) +AUTH="PGP:47627D2288B20CC033C7B7D72D83E4E89C15DA36" diff --git a/entity/licson b/entity/licson new file mode 100644 index 0000000..4d0806d --- /dev/null +++ b/entity/licson @@ -0,0 +1,13 @@ +NAME="licson" +DESC="" +CONTACT=( + "EMAIL:admin@licson.net" + "TELEGRAM:licson" + "IRC:licson" + "MASTODON:" + "GITHUB:licson0729" +) +BABEL=( + "" +) +AUTH="" diff --git a/entity/santost12 b/entity/santost12 index fb1f6e0..e0a429a 100644 --- a/entity/santost12 +++ b/entity/santost12 @@ -10,3 +10,4 @@ CONTACT=( BABEL=( "" ) +AUTH="" diff --git a/node/leedagee b/node/leedagee new file mode 100644 index 0000000..d478866 --- /dev/null +++ b/node/leedagee @@ -0,0 +1,4 @@ +ASN="4201270014" +DESC="" +IP=( +) diff --git a/node/staph b/node/staph index 9a0e697..e5afb33 100644 --- a/node/staph +++ b/node/staph @@ -1,4 +1,5 @@ ASN="4201270007" -DESC="" +DESC="Home of S. aureus in Amsterdam" IP=( + "10.127.8.185/29" ) diff --git a/node/yhi-h b/node/yhi-h new file mode 100644 index 0000000..f13f128 --- /dev/null +++ b/node/yhi-h @@ -0,0 +1,4 @@ +ASN="AS4201270012" +DESC="" +IP=( +) diff --git a/nodes.dot b/nodes.dot index 6cd2ebd..b8e070b 100644 --- a/nodes.dot +++ b/nodes.dot @@ -20,8 +20,8 @@ digraph "NeoNetwork Nodes" magicneko_RU01 [label="M-RU1\n(10.127.4.14,\nfd10:127:0233:7170:2021::10.127.4.14)"] magicneko_JP03 [label="M-JP3\n(10.127.4.15,\nfd10:127:0233:7170:2021::10.127.4.15)"] magicneko_CN01 [label="M-CN1\n(10.127.4.101,\nfd10:127:0233:7170:2021::10.127.4.101)"] - staph [label="s.aureus.ga\n(10.127.8.185)\n(AS4201270007)"] - staph_CN [label="cnhome.aureus.ga\n(10.127.8.187)\n(AS4201270007)"] + staph [label="s.aureus.ga\n(10.127.8.185\nfd10:127:7::1)\n(AS4201270007)"] + staph_CN [label="cnhome.aureus.ga\n(10.127.8.187\nfd10:127:7::3)\n(AS4201270007)"] chenx97 [label="chenx97.neocloud.tw\n(AS4201270003)"] JerryXiao [label="jpn.neo.jerryxiao.cc\n(10.127.8.193)"] JerryXiao_SH01 [label="jerryxiao-sh01\n(10.127.8.195)"] diff --git a/route/10.127.14.0,23 b/route/10.127.14.0,23 new file mode 100644 index 0000000..61095a7 --- /dev/null +++ b/route/10.127.14.0,23 @@ -0,0 +1,4 @@ +TYPE="SUBNET" +NAME="LICSON-NET-SUBALLOC-1" +DESC="" +ASN="134098" diff --git a/route/10.127.23.0,29 b/route/10.127.23.0,29 new file mode 100644 index 0000000..d6dec21 --- /dev/null +++ b/route/10.127.23.0,29 @@ -0,0 +1,4 @@ +TYPE="SUBNET" +NAME="leedagee" +DESC="leedagee" +ASN="4201270014" diff --git a/route/10.127.5.0,28 b/route/10.127.5.0,28 new file mode 100644 index 0000000..d4c1f14 --- /dev/null +++ b/route/10.127.5.0,28 @@ -0,0 +1,4 @@ +TYPE=SUBNET +NAME="yhi-h" +DESC="Yhi Interconnect H" +ASN="AS4201270012" diff --git a/route/10.127.8.184,29 b/route/10.127.8.184,29 index ad82cf8..0ec7caa 100644 --- a/route/10.127.8.184,29 +++ b/route/10.127.8.184,29 @@ -1,4 +1,4 @@ TYPE="SUBNET" NAME="StaphNet" -DESC="For Staph equipments around the world" +DESC="For Staph-infected equipments around the world" ASN="4201270007" diff --git a/route6/fd10:127:0023::,48 b/route6/fd10:127:0023::,48 new file mode 100644 index 0000000..d6dec21 --- /dev/null +++ b/route6/fd10:127:0023::,48 @@ -0,0 +1,4 @@ +TYPE="SUBNET" +NAME="leedagee" +DESC="leedagee" +ASN="4201270014" diff --git a/route6/fd10:127:5f37:59df::,64 b/route6/fd10:127:5f37:59df::,64 index 075f152..8f23768 100644 --- a/route6/fd10:127:5f37:59df::,64 +++ b/route6/fd10:127:5f37:59df::,64 @@ -1,4 +1,4 @@ TYPE=SUBNET -NAME="CROOM" -DESC="For CROOM connectivity" +NAME="NeoNetwork Origin" +DESC="Neo_Chen's Network" ASN="4201270000" diff --git a/route6/fd10:127:7::,48 b/route6/fd10:127:7::,48 new file mode 100644 index 0000000..a80b01c --- /dev/null +++ b/route6/fd10:127:7::,48 @@ -0,0 +1,4 @@ +TYPE="SUBNET" +NAME="Staph_v6" +DESC="Staph-infected IPv6 subnet - please do not disinfect" +ASN="4201270007" diff --git a/scripts/dns-reverse-generator.sh b/scripts/dns-reverse-generator.sh index caf565e..9338540 100755 --- a/scripts/dns-reverse-generator.sh +++ b/scripts/dns-reverse-generator.sh @@ -38,7 +38,7 @@ for i in *; do if [ "$TYPE" = "LO" ]; then ip="${i/,32/}" - print_record "$(ipcalc "$ip" 0)" "$NAME.neo" >> "$LO_TEMP" + print_record "$(ipcalc "$ip" 0)" "$NAME.neo." >> "$LO_TEMP" fi done ) diff --git a/scripts/pretty-output.sh b/scripts/pretty-output.sh index 0469dda..20d0ae6 100755 --- a/scripts/pretty-output.sh +++ b/scripts/pretty-output.sh @@ -99,7 +99,7 @@ if [ $# -lt 1 ]; then "Usage: table-output.sh \n" \ "\n" \ " table types:\n" \ - " asn, route, people, node\n" + " asn, route, entity, node\n" fi arg="$2" # Optional argument @@ -123,15 +123,28 @@ route) subnet="${subnet/,/\/}" source "$i" case "$TYPE" in - TUN30) print_tun30 "$subnet" "$PROTO" "$UPSTREAM" "$DOWNSTREAM";; SUBNET) print_subnet "$subnet" "$NAME" "$DESC";; LO) print_lo "$subnet" "$NAME" "$DESC";; *) errmsg "Invalid \$TYPE in $i\n";; esac done ;; -people);; -node);; +entity);; +node) + for i in node/*; do + node="${i#node/}" + source "$i" + + echo -e \ + "${BRIGHT}${BBLUE}${FYELLOW}========================================${RESET}" + + printf "${BRIGHT}${FYELLOW}%12s${RESET} | ${BRIGHT}${FGREEN}%20s${RESET} | ${FCYAN}%s${RESET}\n" "AS${ASN}" "$node" "$DESC" + + for ip in "${IP[@]}"; do + printf "\t%s\n" "$ip" + done + done + ;; *) errmsg "Invalid type\n";; esac diff --git a/scripts/roa.py b/scripts/roa.py index 0eb5b55..31e681f 100755 --- a/scripts/roa.py +++ b/scripts/roa.py @@ -9,9 +9,7 @@ import re NEONET_ADDR_POOL = ('10.127.0.0/16', 'fd10:127::/32') NEONET_ADDR_POOL = [ip_network(neo) for neo in NEONET_ADDR_POOL] IS_NEONET = lambda net: bool([True for neo in NEONET_ADDR_POOL if net.version == neo.version and net.subnet_of(neo)]) -if not hasattr(IPv4Network, 'subnet_of'): - IS_NEONET = lambda x: True - print('# [!] IPv4Network has no attr subnet_of, please consider upgrading your python installation') +assert hasattr(IPv4Network, 'subnet_of') # needs at least python 3.7 class BashParser: def __init__(self): @@ -79,7 +77,7 @@ def neoneo_get_people(): if not f.is_file(): continue fc = shell2dict(f.read_text()) - present_keys = ('name', 'desc', 'contact', 'babel') + present_keys = ('name', 'desc', 'contact', 'babel', 'auth') assert f.name people[f.name] = {k: fc.get(k) for k in present_keys} nic_hdl = name2nichdl(f.name) @@ -88,6 +86,15 @@ def neoneo_get_people(): people[f.name]['nic_hdl'] = nic_hdl for v in people[f.name].values(): assert v is not None + auth = people[f.name]['auth'] + if auth: + method, data = auth.split(':') + assert method in ('PGP', 'SSH') + if method == 'PGP': + assert len(data) == 40 # invaild pgp fingerprint + elif method == 'SSH': + assert data.startswith('ssh-') # invalid ssh pubkey + people[f.name]['auth'] = f"{'pgp-fingerprint ' if method == 'PGP' else ''}{data.strip()}" except Exception: print("[!] Error while processing file", f) raise @@ -171,16 +178,22 @@ def neonet_route2roa(dirname, is_ipv6=False): print("[!] Error while processing file", f) raise roa_entries.sort(key=lambda l: l['asn']) + l_prefix = [_roa['prefix'] for _roa in roa_entries] for _net1, _net2 in combinations(roa_entries, 2): net1, net2 = sorted([_net1, _net2], key=lambda net: net['prefix'].prefixlen) if net1['prefix'].overlaps(net2['prefix']): - if net1['prefix'] != net2['prefix'] and net1['prefix'].supernet_of(net2['prefix']) \ - and net2['supernet'] == net1['prefix']: - # This is allowed - pass - else: - print("[!] Error: found", net2, "overlaps", net1) - raise AssertionError # if this is intended, please include SUPERNET= in your route + try: + assert net1['prefix'] != net2['prefix'] + assert net1['prefix'].supernet_of(net2['prefix']) + s1net, s2net= (net1['supernet'], net2['supernet']) + assert s2net # please include SUPERNET= in your route + # if net1(the bigger net) has a supernet s1net, then s1net and net1 + # will be checked or must have been checked, same for net2 + assert not s1net or s1net in l_prefix # net1.supernet is garbage + assert s2net == net1['prefix'] or s2net in l_prefix # net2.supernet is garbage + except AssertionError: + print("[!] Error: found", net1, "overlaps", net2) + raise return roa_entries if __name__ == "__main__":