diff options
Diffstat (limited to 'hosts/vidhar/network')
| -rw-r--r-- | hosts/vidhar/network/default.nix | 8 | ||||
| -rw-r--r-- | hosts/vidhar/network/pap-secrets | 26 | ||||
| -rw-r--r-- | hosts/vidhar/network/pppoe.nix (renamed from hosts/vidhar/network/gpon.nix) | 87 | ||||
| -rw-r--r-- | hosts/vidhar/network/ruleset.nft | 78 |
4 files changed, 88 insertions, 111 deletions
diff --git a/hosts/vidhar/network/default.nix b/hosts/vidhar/network/default.nix index 92d755f3..6fcef9d8 100644 --- a/hosts/vidhar/network/default.nix +++ b/hosts/vidhar/network/default.nix | |||
| @@ -1,9 +1,9 @@ | |||
| 1 | { pkgs, lib, ... }: | 1 | { pkgs, lib, config, ... }: |
| 2 | 2 | ||
| 3 | with lib; | 3 | with lib; |
| 4 | 4 | ||
| 5 | { | 5 | { |
| 6 | imports = [ ./gpon.nix ./bifrost ./dhcp ]; | 6 | imports = [ ./pppoe.nix ./bifrost ./dhcp ]; |
| 7 | 7 | ||
| 8 | config = { | 8 | config = { |
| 9 | networking = { | 9 | networking = { |
| @@ -61,7 +61,9 @@ with lib; | |||
| 61 | firewall.enable = false; | 61 | firewall.enable = false; |
| 62 | nftables = { | 62 | nftables = { |
| 63 | enable = true; | 63 | enable = true; |
| 64 | rulesetFile = ./ruleset.nft; | 64 | rulesetFile = pkgs.replaceVars ./ruleset.nft { |
| 65 | inherit (config.networking) pppInterface; | ||
| 66 | }; | ||
| 65 | }; | 67 | }; |
| 66 | 68 | ||
| 67 | resolvconf = { | 69 | resolvconf = { |
diff --git a/hosts/vidhar/network/pap-secrets b/hosts/vidhar/network/pap-secrets deleted file mode 100644 index 3516de6c..00000000 --- a/hosts/vidhar/network/pap-secrets +++ /dev/null | |||
| @@ -1,26 +0,0 @@ | |||
| 1 | { | ||
| 2 | "data": "ENC[AES256_GCM,data:BOyWdys7Oja54Ijv5j+kqufdokQe0onnqw/gVxpNOMf+YI/LlzJscaEtGqPh3ehVtYoSWGumCBPrjdq/zhYq4VV/PCtdeu3MnX1CH2B5bH0mFs0eXcqeGK6NErz/b5nEglv4Z19ig2CUDlbvi8h1zZAEjxTNKhT16ItCtJnBCsIoiMl2QcTTWMyh4a02v3wA1UrOQZvFuCgCHmRoBE6vpREyB23gQdrdKLk7D1LLw5C1aZnzQOhFsgs7bVjOcBnmwTao8ntXxw==,iv:X5FgYkl3DGA/lkRsoc+5XrK3Nlp/ldnFigpXpYNfSJE=,tag:qUH7m9NzuVNnOfr3rRgaOg==,type:str]", | ||
| 3 | "sops": { | ||
| 4 | "kms": null, | ||
| 5 | "gcp_kms": null, | ||
| 6 | "azure_kv": null, | ||
| 7 | "hc_vault": null, | ||
| 8 | "age": [ | ||
| 9 | { | ||
| 10 | "recipient": "age1qffdqvy9arld9zd5a5cylt0n98xhcns5shxhrhwjq5g4qa844ejselaa4l", | ||
| 11 | "enc": "-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSAwYTFaTDZRbDd6cFBRSTNN\nVk1kcFJXRG9TT21IMDZsVmtoZjBTNDNjeDFzCkhxNEI2Ujd6SW1STG43eE5EdzZa\nS3phenJZN0RxajBXQ1BnbUhTa3htdFEKLS0tIGVlT3lReHJSQ2UvQ1FST0M0RzVP\nNmxWNzJmNlFPclJTeDUycDJiUzA4Yk0K4JHtkEPY49TGnKPZzEoEZ131RxeQEWkR\nK1ftH2ilr2tUhiErhpqxoTqfAm33xvruqTsePxh1uC7svzKtKBlS2g==\n-----END AGE ENCRYPTED FILE-----\n" | ||
| 12 | } | ||
| 13 | ], | ||
| 14 | "lastmodified": "2021-11-15T08:30:09Z", | ||
| 15 | "mac": "ENC[AES256_GCM,data:TAgZ4ktdN9sZPMo1UtwjKdTM2QBjLorcm84HYXTGYNNEorPoqrXAWOvyWRLjx+zxzpRuDLBPQHCkjwkVO2CctxnTaWPMwITbYtQqj/5ZxACuAeX8MaSximB8s5MJK2faCuVXEnFehbnnPr5Fs8ZsgHwu2iH6DU8ScLEkgckzGV0=,iv:keUbKwWfoIIBsp5Rsm2lEba1ZHAozQY2YpA6p5qDBiU=,tag:1llGytMGvOjSVYKJXGUmXg==,type:str]", | ||
| 16 | "pgp": [ | ||
| 17 | { | ||
| 18 | "created_at": "2023-01-30T10:58:50Z", | ||
| 19 | "enc": "-----BEGIN PGP MESSAGE-----\n\nhF4DXxoViZlp6dISAQdA+cwEt6Gv5oKvym4ceJek+J/5guNpmsLLXWIY5CCCSXUw\npXyQpqxm7LQnasIqYNNsNCVbB1mAu6WU6MKn0BG03YWjr8buLB+7PpwZcxeZzRfD\n0l4BAsl+vKwa2YSMCR+EWYSfeEzEVHqoGBJ60dYXuiFiNZInCik+g69PdhsGygNH\nRtIcRiCB8t94GkvdWySTq5ohi1wKOe224l9evbt4zXntVngCHxixuufLrr3Cj+EE\n=3lw4\n-----END PGP MESSAGE-----\n", | ||
| 20 | "fp": "30D3453B8CD02FE2A3E7C78C0FB536FB87AE8F51" | ||
| 21 | } | ||
| 22 | ], | ||
| 23 | "unencrypted_suffix": "_unencrypted", | ||
| 24 | "version": "3.7.1" | ||
| 25 | } | ||
| 26 | } \ No newline at end of file | ||
diff --git a/hosts/vidhar/network/gpon.nix b/hosts/vidhar/network/pppoe.nix index 1628159c..5cc84862 100644 --- a/hosts/vidhar/network/gpon.nix +++ b/hosts/vidhar/network/pppoe.nix | |||
| @@ -8,7 +8,7 @@ in { | |||
| 8 | options = { | 8 | options = { |
| 9 | networking.pppInterface = mkOption { | 9 | networking.pppInterface = mkOption { |
| 10 | type = types.str; | 10 | type = types.str; |
| 11 | default = "gpon"; | 11 | default = "ppp"; |
| 12 | }; | 12 | }; |
| 13 | }; | 13 | }; |
| 14 | 14 | ||
| @@ -26,14 +26,14 @@ in { | |||
| 26 | nodefaultroute | 26 | nodefaultroute |
| 27 | ifname ${pppInterface} | 27 | ifname ${pppInterface} |
| 28 | lcp-echo-adaptive | 28 | lcp-echo-adaptive |
| 29 | lcp-echo-failure 5 | 29 | lcp-echo-failure 10 |
| 30 | lcp-echo-interval 1 | 30 | lcp-echo-interval 1 |
| 31 | maxfail 0 | 31 | maxfail 0 |
| 32 | mtu 1492 | 32 | mtu 1492 |
| 33 | mru 1492 | 33 | mru 1492 |
| 34 | plugin pppoe.so | 34 | plugin pppoe.so |
| 35 | name telekom | 35 | user congstar |
| 36 | user 002576900250551137425220#0001@t-online.de | 36 | password congstar |
| 37 | nic-telekom | 37 | nic-telekom |
| 38 | debug | 38 | debug |
| 39 | +ipv6 | 39 | +ipv6 |
| @@ -43,62 +43,55 @@ in { | |||
| 43 | stopIfChanged = true; | 43 | stopIfChanged = true; |
| 44 | 44 | ||
| 45 | serviceConfig = { | 45 | serviceConfig = { |
| 46 | Type = lib.mkForce "notify"; | ||
| 47 | ExecStart = lib.mkForce "${getBin config.services.pppd.package}/sbin/pppd call telekom up_sdnotify nolog"; | ||
| 46 | PIDFile = "/run/pppd/${pppInterface}.pid"; | 48 | PIDFile = "/run/pppd/${pppInterface}.pid"; |
| 47 | }; | 49 | }; |
| 48 | restartTriggers = with config; [ | 50 | restartTriggers = with config; [ |
| 49 | environment.etc."ppp/ip-pre-up".source | 51 | environment.etc."ppp/ip-pre-up".source |
| 50 | environment.etc."ppp/ip-up".source | 52 | environment.etc."ppp/ip-up".source |
| 51 | environment.etc."ppp/ip-down".source | 53 | environment.etc."ppp/ip-down".source |
| 52 | # sops.secrets."pap-secrets".sopsFile | ||
| 53 | ]; | 54 | ]; |
| 54 | }; | 55 | }; |
| 55 | sops.secrets."pap-secrets" = { | ||
| 56 | format = "binary"; | ||
| 57 | sopsFile = ./pap-secrets; | ||
| 58 | path = "/etc/ppp/pap-secrets"; | ||
| 59 | }; | ||
| 60 | 56 | ||
| 61 | environment.etc = { | 57 | environment.etc = { |
| 62 | "ppp/ip-pre-up".source = let | 58 | "ppp/ip-pre-up".source = pkgs.resholve.writeScript "ip-pre-up" { |
| 63 | app = pkgs.writeShellApplication { | 59 | interpreter = pkgs.runtimeShell; |
| 64 | name = "ip-pre-up"; | 60 | inputs = [ pkgs.iproute2 pkgs.ethtool ]; |
| 65 | runtimeInputs = with pkgs; [ iproute2 ethtool ]; | 61 | execer = [ |
| 66 | text = '' | 62 | "cannot:${lib.getExe' pkgs.iproute2 "ip"}" |
| 67 | ethtool -K telekom tso off gso off gro off | 63 | "cannot:${lib.getExe' pkgs.iproute2 "tc"}" |
| 64 | ]; | ||
| 65 | } '' | ||
| 66 | ethtool -K telekom tso off gso off gro off | ||
| 68 | 67 | ||
| 69 | ip link del "ifb4${pppInterface}" || true | 68 | ip link del "ifb4${pppInterface}" || true |
| 70 | ip link add name "ifb4${pppInterface}" type ifb | 69 | ip link add name "ifb4${pppInterface}" type ifb |
| 71 | ip link set "ifb4${pppInterface}" up | 70 | ip link set "ifb4${pppInterface}" up |
| 72 | 71 | ||
| 73 | tc qdisc del dev "ifb4${pppInterface}" root || true | 72 | tc qdisc del dev "ifb4${pppInterface}" root || true |
| 74 | tc qdisc del dev "${pppInterface}" ingress || true | 73 | tc qdisc del dev "${pppInterface}" ingress || true |
| 75 | tc qdisc del dev "${pppInterface}" root || true | 74 | tc qdisc del dev "${pppInterface}" root || true |
| 76 | 75 | ||
| 77 | tc qdisc add dev "${pppInterface}" handle ffff: ingress | 76 | tc qdisc add dev "${pppInterface}" handle ffff: ingress |
| 78 | tc filter add dev "${pppInterface}" parent ffff: basic action ctinfo dscp 0x0000003f 0x00000040 action mirred egress redirect dev "ifb4${pppInterface}" | 77 | tc filter add dev "${pppInterface}" parent ffff: basic action ctinfo dscp 0x0000003f 0x00000040 action mirred egress redirect dev "ifb4${pppInterface}" |
| 79 | tc qdisc replace dev "ifb4${pppInterface}" root cake memlimit 128Mb overhead 35 mpu 74 regional diffserv4 bandwidth 285mbit | 78 | tc qdisc replace dev "ifb4${pppInterface}" root cake memlimit 128Mb overhead 35 mpu 74 regional diffserv4 bandwidth ${toString (builtins.floor (177968 * 0.95))}kbit |
| 80 | tc qdisc replace dev "${pppInterface}" root cake memlimit 128Mb overhead 35 mpu 74 regional nat diffserv4 wash bandwidth 143mbit | 79 | tc qdisc replace dev "${pppInterface}" root cake memlimit 128Mb overhead 35 mpu 74 regional nat diffserv4 wash bandwidth ${toString (builtins.floor (41216 * 0.95))}kbit |
| 81 | ''; | 80 | ''; |
| 82 | }; | 81 | "ppp/ip-up".source = pkgs.resholve.writeScript "ip-up" { |
| 83 | in "${app}/bin/${app.meta.mainProgram}"; | 82 | interpreter = pkgs.runtimeShell; |
| 84 | "ppp/ip-up".source = let | 83 | inputs = [ pkgs.iproute2 ]; |
| 85 | app = pkgs.writeShellApplication { | 84 | execer = [ "cannot:${lib.getExe' pkgs.iproute2 "ip"}" ]; |
| 86 | name = "ip-up"; | 85 | } '' |
| 87 | runtimeInputs = with pkgs; [ iproute2 ]; | 86 | ip route add default via "$5" dev "${pppInterface}" metric 512 |
| 88 | text = '' | 87 | ''; |
| 89 | ip route add default via "$5" dev "${pppInterface}" metric 512 | 88 | "ppp/ip-down".source = pkgs.resholve.writeScript "ip-down" { |
| 90 | ''; | 89 | interpreter = pkgs.runtimeShell; |
| 91 | }; | 90 | inputs = [ pkgs.iproute2 ]; |
| 92 | in "${app}/bin/${app.meta.mainProgram}"; | 91 | execer = [ "cannot:${lib.getExe' pkgs.iproute2 "ip"}" ]; |
| 93 | "ppp/ip-down".source = let | 92 | } '' |
| 94 | app = pkgs.writeShellApplication { | 93 | ip link del "ifb4${pppInterface}" |
| 95 | name = "ip-down"; | 94 | ''; |
| 96 | runtimeInputs = with pkgs; [ iproute2 ]; | ||
| 97 | text = '' | ||
| 98 | ip link del "ifb4${pppInterface}" | ||
| 99 | ''; | ||
| 100 | }; | ||
| 101 | in "${app}/bin/${app.meta.mainProgram}"; | ||
| 102 | }; | 95 | }; |
| 103 | 96 | ||
| 104 | systemd.network.networks.${pppInterface} = { | 97 | systemd.network.networks.${pppInterface} = { |
diff --git a/hosts/vidhar/network/ruleset.nft b/hosts/vidhar/network/ruleset.nft index 6b0ac9fc..dd750394 100644 --- a/hosts/vidhar/network/ruleset.nft +++ b/hosts/vidhar/network/ruleset.nft | |||
| @@ -5,15 +5,15 @@ table arp filter { | |||
| 5 | limit lim_arp_local { | 5 | limit lim_arp_local { |
| 6 | rate over 50 mbytes/second burst 50 mbytes | 6 | rate over 50 mbytes/second burst 50 mbytes |
| 7 | } | 7 | } |
| 8 | limit lim_arp_gpon { | 8 | limit lim_arp_ppp { |
| 9 | rate over 7500 kbytes/second burst 7500 kbytes | 9 | rate over 7500 kbytes/second burst 7500 kbytes |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | counter arp-rx {} | 12 | counter arp-rx {} |
| 13 | counter arp-tx {} | 13 | counter arp-tx {} |
| 14 | 14 | ||
| 15 | counter arp-ratelimit-gpon-rx {} | 15 | counter arp-ratelimit-ppp-rx {} |
| 16 | counter arp-ratelimit-gpon-tx {} | 16 | counter arp-ratelimit-ppp-tx {} |
| 17 | 17 | ||
| 18 | counter arp-ratelimit-local-rx {} | 18 | counter arp-ratelimit-local-rx {} |
| 19 | counter arp-ratelimit-local-tx {} | 19 | counter arp-ratelimit-local-tx {} |
| @@ -22,8 +22,8 @@ table arp filter { | |||
| 22 | type filter hook input priority filter | 22 | type filter hook input priority filter |
| 23 | policy accept | 23 | policy accept |
| 24 | 24 | ||
| 25 | iifname != gpon limit name lim_arp_local counter name arp-ratelimit-local-rx drop | 25 | iifname != @pppInterface@ limit name lim_arp_local counter name arp-ratelimit-local-rx drop |
| 26 | iifname gpon limit name lim_arp_gpon counter name arp-ratelimit-gpon-rx drop | 26 | iifname @pppInterface@ limit name lim_arp_ppp counter name arp-ratelimit-ppp-rx drop |
| 27 | 27 | ||
| 28 | counter name arp-rx | 28 | counter name arp-rx |
| 29 | } | 29 | } |
| @@ -32,8 +32,8 @@ table arp filter { | |||
| 32 | type filter hook output priority filter | 32 | type filter hook output priority filter |
| 33 | policy accept | 33 | policy accept |
| 34 | 34 | ||
| 35 | oifname != gpon limit name lim_arp_local counter name arp-ratelimit-local-tx drop | 35 | oifname != @pppInterface@ limit name lim_arp_local counter name arp-ratelimit-local-tx drop |
| 36 | oifname gpon limit name lim_arp_gpon counter name arp-ratelimit-gpon-tx drop | 36 | oifname @pppInterface@ limit name lim_arp_ppp counter name arp-ratelimit-ppp-tx drop |
| 37 | 37 | ||
| 38 | counter name arp-tx | 38 | counter name arp-tx |
| 39 | } | 39 | } |
| @@ -47,11 +47,11 @@ table inet filter { | |||
| 47 | limit lim_icmp_local { | 47 | limit lim_icmp_local { |
| 48 | rate over 50 mbytes/second burst 50 mbytes | 48 | rate over 50 mbytes/second burst 50 mbytes |
| 49 | } | 49 | } |
| 50 | limit lim_icmp_gpon { | 50 | limit lim_icmp_ppp { |
| 51 | rate over 7500 kbytes/second burst 7500 kbytes | 51 | rate over 7500 kbytes/second burst 7500 kbytes |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | counter icmp-ratelimit-gpon-fw {} | 54 | counter icmp-ratelimit-ppp-fw {} |
| 55 | counter icmp-ratelimit-local-fw {} | 55 | counter icmp-ratelimit-local-fw {} |
| 56 | 56 | ||
| 57 | counter icmp-fw {} | 57 | counter icmp-fw {} |
| @@ -59,7 +59,8 @@ table inet filter { | |||
| 59 | counter invalid-fw {} | 59 | counter invalid-fw {} |
| 60 | counter fw-lo {} | 60 | counter fw-lo {} |
| 61 | counter fw-lan {} | 61 | counter fw-lan {} |
| 62 | counter fw-gpon {} | 62 | counter fw-ppp {} |
| 63 | counter fw-kimai {} | ||
| 63 | 64 | ||
| 64 | counter fw-cups {} | 65 | counter fw-cups {} |
| 65 | 66 | ||
| @@ -74,7 +75,7 @@ table inet filter { | |||
| 74 | counter invalid-local4-rx {} | 75 | counter invalid-local4-rx {} |
| 75 | counter invalid-local6-rx {} | 76 | counter invalid-local6-rx {} |
| 76 | 77 | ||
| 77 | counter icmp-ratelimit-gpon-rx {} | 78 | counter icmp-ratelimit-ppp-rx {} |
| 78 | counter icmp-ratelimit-local-rx {} | 79 | counter icmp-ratelimit-local-rx {} |
| 79 | counter icmp-rx {} | 80 | counter icmp-rx {} |
| 80 | 81 | ||
| @@ -95,6 +96,7 @@ table inet filter { | |||
| 95 | counter paperless-rx {} | 96 | counter paperless-rx {} |
| 96 | counter hledger-rx {} | 97 | counter hledger-rx {} |
| 97 | counter audiobookshelf-rx {} | 98 | counter audiobookshelf-rx {} |
| 99 | counter kimai-rx {} | ||
| 98 | 100 | ||
| 99 | counter established-rx {} | 101 | counter established-rx {} |
| 100 | 102 | ||
| @@ -106,7 +108,7 @@ table inet filter { | |||
| 106 | 108 | ||
| 107 | counter tx-lo {} | 109 | counter tx-lo {} |
| 108 | 110 | ||
| 109 | counter icmp-ratelimit-gpon-tx {} | 111 | counter icmp-ratelimit-ppp-tx {} |
| 110 | counter icmp-ratelimit-local-tx {} | 112 | counter icmp-ratelimit-local-tx {} |
| 111 | counter icmp-tx {} | 113 | counter icmp-tx {} |
| 112 | 114 | ||
| @@ -127,15 +129,16 @@ table inet filter { | |||
| 127 | counter paperless-tx {} | 129 | counter paperless-tx {} |
| 128 | counter hledger-tx {} | 130 | counter hledger-tx {} |
| 129 | counter audiobookshelf-tx {} | 131 | counter audiobookshelf-tx {} |
| 132 | counter kimai-tx {} | ||
| 130 | 133 | ||
| 131 | counter tx {} | 134 | counter tx {} |
| 132 | 135 | ||
| 133 | 136 | ||
| 134 | chain forward_icmp_accept { | 137 | chain forward_icmp_accept { |
| 135 | oifname { gpon, bifrost } limit name lim_icmp_gpon counter name icmp-ratelimit-gpon-fw drop | 138 | oifname { @pppInterface@, bifrost } limit name lim_icmp_ppp counter name icmp-ratelimit-ppp-fw drop |
| 136 | iifname { gpon, bifrost } limit name lim_icmp_gpon counter name icmp-ratelimit-gpon-fw drop | 139 | iifname { @pppInterface@, bifrost } limit name lim_icmp_ppp counter name icmp-ratelimit-ppp-fw drop |
| 137 | oifname != { gpon, bifrost } limit name lim_icmp_local counter name icmp-ratelimit-local-fw drop | 140 | oifname != { @pppInterface@, bifrost } limit name lim_icmp_local counter name icmp-ratelimit-local-fw drop |
| 138 | iifname != { gpon, bifrost } limit name lim_icmp_local counter name icmp-ratelimit-local-fw drop | 141 | iifname != { @pppInterface@, bifrost } limit name lim_icmp_local counter name icmp-ratelimit-local-fw drop |
| 139 | counter name icmp-fw accept | 142 | counter name icmp-fw accept |
| 140 | } | 143 | } |
| 141 | chain forward { | 144 | chain forward { |
| @@ -148,10 +151,15 @@ table inet filter { | |||
| 148 | 151 | ||
| 149 | iifname lo counter name fw-lo accept | 152 | iifname lo counter name fw-lo accept |
| 150 | 153 | ||
| 151 | oifname { lan, gpon, bifrost } meta l4proto $icmp_protos jump forward_icmp_accept | 154 | oifname { lan, @pppInterface@, bifrost } meta l4proto $icmp_protos jump forward_icmp_accept |
| 152 | iifname lan oifname { gpon, bifrost } counter name fw-lan accept | 155 | iifname lan oifname { @pppInterface@, bifrost } counter name fw-lan accept |
| 156 | iifname ve-kimai oifname @pppInterface@ counter name fw-kimai accept | ||
| 153 | 157 | ||
| 154 | iifname gpon oifname lan ct state { established, related } counter name fw-gpon accept | 158 | iifname @pppInterface@ oifname lan ct state { established, related } counter name fw-ppp accept |
| 159 | iifname @pppInterface@ oifname ve-kimai ct state { established, related } counter name fw-kimai accept | ||
| 160 | |||
| 161 | iifname bifrost oifname ve-kimai tcp dport 80 ip6 saddr $bifrost_surtr ip6 daddr 2a03:4000:52:ada:6::2 counter name kimai-rx accept | ||
| 162 | iifname ve-kimai oifname bifrost tcp sport 80 ip6 saddr 2a03:4000:52:ada:6::2 ip6 daddr $bifrost_surtr counter name kimai-tx accept | ||
| 155 | 163 | ||
| 156 | 164 | ||
| 157 | limit name lim_reject log level debug prefix "drop forward: " counter name reject-ratelimit-fw drop | 165 | limit name lim_reject log level debug prefix "drop forward: " counter name reject-ratelimit-fw drop |
| @@ -172,22 +180,22 @@ table inet filter { | |||
| 172 | iif != lo ip daddr 127.0.0.1/8 counter name invalid-local4-rx reject | 180 | iif != lo ip daddr 127.0.0.1/8 counter name invalid-local4-rx reject |
| 173 | iif != lo ip6 daddr ::1/128 counter name invalid-local6-rx reject | 181 | iif != lo ip6 daddr ::1/128 counter name invalid-local6-rx reject |
| 174 | 182 | ||
| 175 | iifname { bifrost, gpon } meta l4proto $icmp_protos limit name lim_icmp_gpon counter name icmp-ratelimit-gpon-rx drop | 183 | iifname { bifrost, @pppInterface@ } meta l4proto $icmp_protos limit name lim_icmp_ppp counter name icmp-ratelimit-ppp-rx drop |
| 176 | iifname != { bifrost, gpon } meta l4proto $icmp_protos limit name lim_icmp_local counter name icmp-ratelimit-local-rx drop | 184 | iifname != { bifrost, @pppInterface@ } meta l4proto $icmp_protos limit name lim_icmp_local counter name icmp-ratelimit-local-rx drop |
| 177 | meta l4proto $icmp_protos counter name icmp-rx accept | 185 | meta l4proto $icmp_protos counter name icmp-rx accept |
| 178 | 186 | ||
| 179 | iifname { lan, mgmt, gpon, yggdrasil, bifrost } tcp dport 22 counter name ssh-rx accept | 187 | iifname { lan, mgmt, @pppInterface@, yggdrasil, bifrost } tcp dport 22 counter name ssh-rx accept |
| 180 | iifname { lan, mgmt, gpon, yggdrasil, bifrost } udp dport 60000-61000 counter name mosh-rx accept | 188 | iifname { lan, mgmt, @pppInterface@, yggdrasil, bifrost } udp dport 60000-61000 counter name mosh-rx accept |
| 181 | 189 | ||
| 182 | iifname { lan, mgmt, wifibh, yggdrasil } meta l4proto { tcp, udp } th dport 53 counter name dns-rx accept | 190 | iifname { lan, mgmt, wifibh, yggdrasil } meta l4proto { tcp, udp } th dport 53 counter name dns-rx accept |
| 183 | 191 | ||
| 184 | iifname { lan, yggdrasil } tcp dport 2049 counter name nfs-rx accept | 192 | iifname { lan, yggdrasil } tcp dport 2049 counter name nfs-rx accept |
| 185 | 193 | ||
| 186 | iifname { lan, mgmt, gpon } meta protocol ip udp dport 51820 counter name wg-rx accept | 194 | iifname { lan, mgmt, @pppInterface@ } meta protocol ip udp dport 51820 counter name wg-rx accept |
| 187 | iifname { lan, mgmt, gpon } meta protocol ip6 udp dport 51821 counter name wg-rx accept | 195 | iifname { lan, mgmt, @pppInterface@ } meta protocol ip6 udp dport 51821 counter name wg-rx accept |
| 188 | iifname "yggdrasil-wg-*" meta l4proto gre counter name yggdrasil-gre-rx accept | 196 | iifname "yggdrasil-wg-*" meta l4proto gre counter name yggdrasil-gre-rx accept |
| 189 | 197 | ||
| 190 | iifname gpon meta protocol ip6 udp dport 546 udp sport 547 counter name ipv6-pd-rx accept | 198 | iifname @pppInterface@ meta protocol ip6 udp dport 546 udp sport 547 counter name ipv6-pd-rx accept |
| 191 | 199 | ||
| 192 | iifname mgmt udp dport 123 counter name ntp-rx accept | 200 | iifname mgmt udp dport 123 counter name ntp-rx accept |
| 193 | 201 | ||
| @@ -223,8 +231,8 @@ table inet filter { | |||
| 223 | 231 | ||
| 224 | oifname lo counter name tx-lo accept | 232 | oifname lo counter name tx-lo accept |
| 225 | 233 | ||
| 226 | oifname { bifrost, gpon } meta l4proto $icmp_protos limit name lim_icmp_gpon counter name icmp-ratelimit-gpon-tx drop | 234 | oifname { bifrost, @pppInterface@ } meta l4proto $icmp_protos limit name lim_icmp_ppp counter name icmp-ratelimit-ppp-tx drop |
| 227 | oifname != { bifrost, gpon } meta l4proto $icmp_protos limit name lim_icmp_local counter name icmp-ratelimit-local-tx drop | 235 | oifname != { bifrost, @pppInterface@ } meta l4proto $icmp_protos limit name lim_icmp_local counter name icmp-ratelimit-local-tx drop |
| 228 | meta l4proto $icmp_protos counter name icmp-tx accept | 236 | meta l4proto $icmp_protos counter name icmp-tx accept |
| 229 | 237 | ||
| 230 | 238 | ||
| @@ -265,28 +273,28 @@ table inet filter { | |||
| 265 | } | 273 | } |
| 266 | 274 | ||
| 267 | table inet nat { | 275 | table inet nat { |
| 268 | counter gpon-nat {} | 276 | counter ppp-nat {} |
| 269 | # counter container-nat {} | 277 | counter kimai-nat {} |
| 270 | 278 | ||
| 271 | chain postrouting { | 279 | chain postrouting { |
| 272 | type nat hook postrouting priority srcnat | 280 | type nat hook postrouting priority srcnat |
| 273 | policy accept | 281 | policy accept |
| 274 | 282 | ||
| 275 | 283 | ||
| 276 | meta nfproto ipv4 oifname gpon counter name gpon-nat masquerade | 284 | meta nfproto ipv4 oifname @pppInterface@ counter name ppp-nat masquerade |
| 277 | # iifname ve-* oifname gpon counter name container-nat masquerade | 285 | iifname ve-kimai oifname @pppInterface@ counter name kimai-nat masquerade |
| 278 | } | 286 | } |
| 279 | } | 287 | } |
| 280 | 288 | ||
| 281 | table inet mss_clamp { | 289 | table inet mss_clamp { |
| 282 | counter gpon-mss-clamp {} | 290 | counter ppp-mss-clamp {} |
| 283 | 291 | ||
| 284 | chain postrouting { | 292 | chain postrouting { |
| 285 | type filter hook postrouting priority mangle | 293 | type filter hook postrouting priority mangle |
| 286 | policy accept | 294 | policy accept |
| 287 | 295 | ||
| 288 | 296 | ||
| 289 | oifname gpon tcp flags & (syn|rst) == syn counter name gpon-mss-clamp tcp option maxseg size set rt mtu | 297 | oifname @pppInterface@ tcp flags & (syn|rst) == syn counter name ppp-mss-clamp tcp option maxseg size set rt mtu |
| 290 | } | 298 | } |
| 291 | } | 299 | } |
| 292 | 300 | ||
| @@ -421,7 +429,7 @@ table inet dscpclassify { | |||
| 421 | chain postrouting { | 429 | chain postrouting { |
| 422 | type filter hook postrouting priority filter + 1; policy accept | 430 | type filter hook postrouting priority filter + 1; policy accept |
| 423 | 431 | ||
| 424 | oifname != gpon return | 432 | oifname != @pppInterface@ return |
| 425 | 433 | ||
| 426 | ip dscp cs0 goto ct_set_cs0 | 434 | ip dscp cs0 goto ct_set_cs0 |
| 427 | ip dscp lephb goto ct_set_lephb | 435 | ip dscp lephb goto ct_set_lephb |
