diff options
Diffstat (limited to 'hosts/vidhar/network')
| -rw-r--r-- | hosts/vidhar/network/default.nix | 17 | ||||
| -rw-r--r-- | hosts/vidhar/network/dhcp/default.nix | 221 | ||||
| -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 | 82 | 
5 files changed, 270 insertions, 163 deletions
diff --git a/hosts/vidhar/network/default.nix b/hosts/vidhar/network/default.nix index 0643f0bb..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 = { | 
| @@ -103,7 +105,14 @@ with lib; | |||
| 103 | /srv/nfs/nix-store 10.141.0.0/24(ro,async,root_squash) 2a03:4000:52:ada:1::/80(ro,async,root_squash) | 105 | /srv/nfs/nix-store 10.141.0.0/24(ro,async,root_squash) 2a03:4000:52:ada:1::/80(ro,async,root_squash) | 
| 104 | ''; | 106 | ''; | 
| 105 | }; | 107 | }; | 
| 106 | settings.nfsd.vers3 = false; | 108 | settings.nfsd = { | 
| 109 | rdma = true; | ||
| 110 | vers3 = false; | ||
| 111 | vers4 = true; | ||
| 112 | "vers4.0" = false; | ||
| 113 | "vers4.1" = false; | ||
| 114 | "vers4.2" = true; | ||
| 115 | }; | ||
| 107 | }; | 116 | }; | 
| 108 | 117 | ||
| 109 | fileSystems = { | 118 | fileSystems = { | 
diff --git a/hosts/vidhar/network/dhcp/default.nix b/hosts/vidhar/network/dhcp/default.nix index 07a83351..11460393 100644 --- a/hosts/vidhar/network/dhcp/default.nix +++ b/hosts/vidhar/network/dhcp/default.nix  | |||
| @@ -1,8 +1,33 @@ | |||
| 1 | { flake, config, pkgs, lib, ... }: | 1 | { flake, config, pkgs, lib, sources, ... }: | 
| 2 | 2 | ||
| 3 | with lib; | 3 | with lib; | 
| 4 | 4 | ||
| 5 | { | 5 | let | 
| 6 | nfsrootBaseUrl = "http://nfsroot.vidhar.yggdrasil"; | ||
| 7 | tftpIp = "10.141.0.1"; | ||
| 8 | nfsIp = tftpIp; | ||
| 9 | ipxe = pkgs.ipxe.override { | ||
| 10 | additionalTargets = { | ||
| 11 | "bin-i386-efi/ipxe.efi" = "i386-ipxe.efi"; | ||
| 12 | }; | ||
| 13 | additionalOptions = [ | ||
| 14 | "NSLOOKUP_CMD" | ||
| 15 | "PING_CMD" | ||
| 16 | "CONSOLE_CMD" | ||
| 17 | ]; | ||
| 18 | embedScript = pkgs.writeText "yggdrasil.ipxe" '' | ||
| 19 | #!ipxe | ||
| 20 | |||
| 21 | cpair --background 9 1 | ||
| 22 | cpair --background 9 3 | ||
| 23 | cpair --background 9 6 | ||
| 24 | |||
| 25 | set user-class iPXE-yggdrasil | ||
| 26 | |||
| 27 | autoboot | ||
| 28 | ''; | ||
| 29 | }; | ||
| 30 | in { | ||
| 6 | config = { | 31 | config = { | 
| 7 | services.kea = { | 32 | services.kea = { | 
| 8 | dhcp4 = { | 33 | dhcp4 = { | 
| @@ -23,41 +48,67 @@ with lib; | |||
| 23 | }; | 48 | }; | 
| 24 | 49 | ||
| 25 | client-classes = [ | 50 | client-classes = [ | 
| 26 | { name = "eostre-ipxe"; | 51 | { name = "ipxe-eostre"; | 
| 27 | test = "hexstring(pkt4.mac, ':') == '00:d8:61:79:c5:40' and option[77].hex == 'iPXE'"; | 52 | test = "hexstring(pkt4.mac, ':') == '00:d8:61:79:c5:40' and option[77].hex == 'iPXE-yggdrasil'"; | 
| 28 | next-server = "10.141.0.1"; | 53 | next-server = tftpIp; | 
| 29 | boot-file-name = "http://nfsroot.vidhar.yggdrasil/eostre/netboot.ipxe"; | 54 | boot-file-name = "${nfsrootBaseUrl}/eostre.menu.ipxe"; | 
| 55 | only-if-required = true; | ||
| 56 | } | ||
| 57 | { name = "ipxe-yggdrasil"; | ||
| 58 | test = "option[77].hex == 'iPXE-yggdrasil'"; | ||
| 59 | next-server = tftpIp; | ||
| 60 | boot-file-name = "${nfsrootBaseUrl}/installer-x86_64-linux.menu.ipxe"; | ||
| 61 | only-if-required = true; | ||
| 62 | } | ||
| 63 | |||
| 64 | { name = "uefi-http"; | ||
| 65 | test = "option[client-system].hex == 0x0010"; | ||
| 66 | option-data = [ | ||
| 67 | { name = "vendor-class-identifier"; data = "HTTPClient"; } | ||
| 68 | ]; | ||
| 69 | boot-file-name = "${nfsrootBaseUrl}/ipxe.efi"; | ||
| 70 | only-if-required = true; | ||
| 71 | } | ||
| 72 | |||
| 73 | { name = "ipxe-uefi-64"; | ||
| 74 | test = "option[77].hex == 'iPXE' and (substring(option[60].hex,0,20) == 'PXEClient:Arch:00007' or substring(option[60].hex,0,20) == 'PXEClient:Arch:00008' or substring(option[60].hex,0,20) == 'PXEClient:Arch:00009')"; | ||
| 75 | boot-file-name = "${nfsrootBaseUrl}/ipxe.efi"; | ||
| 76 | only-if-required = true; | ||
| 77 | } | ||
| 78 | { name = "ipxe-uefi-32"; | ||
| 79 | test = "option[77].hex == 'iPXE' and (substring(option[60].hex,0,20) == 'PXEClient:Arch:00002' or substring(option[60].hex,0,20) == 'PXEClient:Arch:00006')"; | ||
| 80 | boot-file-name = "${nfsrootBaseUrl}/i386-ipxe.efi"; | ||
| 30 | only-if-required = true; | 81 | only-if-required = true; | 
| 31 | } | 82 | } | 
| 32 | { name = "ipxe"; | 83 | { name = "ipxe-legacy"; | 
| 33 | test = "option[77].hex == 'iPXE'"; | 84 | test = "option[77].hex == 'iPXE' and substring(option[60].hex,0,20) == 'PXEClient:Arch:00000'"; | 
| 34 | next-server = "10.141.0.1"; | 85 | boot-file-name = "${nfsrootBaseUrl}/ipxe.lkrn"; | 
| 35 | boot-file-name = "http://nfsroot.vidhar.yggdrasil/installer-x86_64-linux/netboot.ipxe"; | ||
| 36 | only-if-required = true; | 86 | only-if-required = true; | 
| 37 | } | 87 | } | 
| 88 | |||
| 38 | { name = "uefi-64"; | 89 | { name = "uefi-64"; | 
| 39 | test = "substring(option[60].hex,0,20) == 'PXEClient:Arch:00007' or substring(option[60].hex,0,20) == 'PXEClient:Arch:00008' or substring(option[60].hex,0,20) == 'PXEClient:Arch:00009'"; | 90 | test = "substring(option[60].hex,0,20) == 'PXEClient:Arch:00007' or substring(option[60].hex,0,20) == 'PXEClient:Arch:00008' or substring(option[60].hex,0,20) == 'PXEClient:Arch:00009'"; | 
| 40 | only-if-required = true; | ||
| 41 | option-data = [ | 91 | option-data = [ | 
| 42 | { name = "tftp-server-name"; data = "10.141.0.1"; } | 92 | { name = "tftp-server-name"; data = tftpIp; } | 
| 43 | ]; | 93 | ]; | 
| 44 | boot-file-name = "ipxe.efi"; | 94 | boot-file-name = "ipxe.efi"; | 
| 95 | only-if-required = true; | ||
| 45 | } | 96 | } | 
| 46 | { name = "uefi-32"; | 97 | { name = "uefi-32"; | 
| 47 | test = "substring(option[60].hex,0,20) == 'PXEClient:Arch:00002' or substring(option[60].hex,0,20) == 'PXEClient:Arch:00006'"; | 98 | test = "substring(option[60].hex,0,20) == 'PXEClient:Arch:00002' or substring(option[60].hex,0,20) == 'PXEClient:Arch:00006'"; | 
| 48 | only-if-required = true; | ||
| 49 | option-data = [ | 99 | option-data = [ | 
| 50 | { name = "tftp-server-name"; data = "10.141.0.1"; } | 100 | { name = "tftp-server-name"; data = tftpIp; } | 
| 51 | ]; | 101 | ]; | 
| 52 | boot-file-name = "i386-ipxe.efi"; | 102 | boot-file-name = "i386-ipxe.efi"; | 
| 103 | only-if-required = true; | ||
| 53 | } | 104 | } | 
| 54 | { name = "legacy"; | 105 | { name = "legacy"; | 
| 55 | test = "substring(option[60].hex,0,20) == 'PXEClient:Arch:00000'"; | 106 | test = "substring(option[60].hex,0,20) == 'PXEClient:Arch:00000'"; | 
| 56 | only-if-required = true; | ||
| 57 | option-data = [ | 107 | option-data = [ | 
| 58 | { name = "tftp-server-name"; data = "10.141.0.1"; } | 108 | { name = "tftp-server-name"; data = tftpIp; } | 
| 59 | ]; | 109 | ]; | 
| 60 | boot-file-name = "undionly.kpxe"; | 110 | boot-file-name = "ipxe.lkrn"; | 
| 111 | only-if-required = true; | ||
| 61 | } | 112 | } | 
| 62 | ]; | 113 | ]; | 
| 63 | 114 | ||
| @@ -252,34 +303,78 @@ with lib; | |||
| 252 | name = "nfsroot.vidhar.yggdrasil"; | 303 | name = "nfsroot.vidhar.yggdrasil"; | 
| 253 | paths = | 304 | paths = | 
| 254 | (map (system: | 305 | (map (system: | 
| 255 | let | 306 | pkgs.symlinkJoin { | 
| 256 | installerBuild = (flake.nixosConfigurations.${"installer-${system}-nfsroot"}.extendModules { | 307 | name = "installer-${system}"; | 
| 257 | modules = [ | 308 | paths = [ | 
| 258 | ({ ... }: { | 309 | (builtins.addErrorContext "while evaluating installer-${system}-nfsroot" (let | 
| 259 | config.nfsroot.storeDevice = "10.141.0.1:nix-store"; | 310 | installerBuild' = (flake.nixosConfigurations.${"installer-${system}-nfsroot"}.extendModules { | 
| 260 | config.nfsroot.registrationUrl = "http://nfsroot.vidhar.yggdrasil/installer-${system}/registration"; | 311 | modules = [ | 
| 261 | }) | 312 | ({ ... }: { | 
| 262 | ]; | 313 | config.nfsroot.storeDevice = "${nfsIp}:nix-store"; | 
| 263 | }).config.system.build; | 314 | config.nfsroot.registrationUrl = "${nfsrootBaseUrl}/installer-${system}/registration"; | 
| 264 | in builtins.toPath (pkgs.runCommandLocal "install-${system}" {} '' | 315 | config.system.nixos.label = "installer-${system}"; | 
| 265 | mkdir -p $out/installer-${system} | 316 | }) | 
| 266 | install -m 0444 -t $out/installer-${system} \ | 317 | ]; | 
| 267 | ${installerBuild.initialRamdisk}/initrd \ | 318 | }); | 
| 268 | ${installerBuild.kernel}/bzImage \ | 319 | installerBuild = installerBuild'.config.system.build; | 
| 269 | ${installerBuild.netbootIpxeScript}/netboot.ipxe \ | 320 | in builtins.toPath (pkgs.runCommandLocal "installer-${system}" {} '' | 
| 270 | ${pkgs.closureInfo { rootPaths = installerBuild.storeContents; }}/registration | 321 | mkdir -p $out/installer-${system} | 
| 271 | '') | 322 | install -m 0444 -t $out/installer-${system} \ | 
| 272 | ) ["x86_64-linux"] | 323 | ${installerBuild.initialRamdisk}/initrd \ | 
| 324 | ${installerBuild.kernel}/bzImage \ | ||
| 325 | ${installerBuild.netbootIpxeScript}/netboot.ipxe \ | ||
| 326 | ${pkgs.closureInfo { rootPaths = installerBuild.storeContents; }}/registration | ||
| 327 | install -m 0444 ${pkgs.writeText "installer-${system}.menu.ipxe" '' | ||
| 328 | #!ipxe | ||
| 329 | |||
| 330 | :start | ||
| 331 | menu iPXE boot menu for installer-${system} | ||
| 332 | item installer ${with installerBuild'; "${config.system.nixos.distroName} ${config.system.nixos.codeName} ${config.system.nixos.label} (Linux ${config.boot.kernelPackages.kernel.modDirVersion})"} | ||
| 333 | item memtest memtest86plus | ||
| 334 | item netboot netboot.xyz | ||
| 335 | item shell iPXE shell | ||
| 336 | choose --timeout 0 --default installer selected || goto shell | ||
| 337 | goto ''${selected} | ||
| 338 | |||
| 339 | :shell | ||
| 340 | shell | ||
| 341 | goto start | ||
| 342 | |||
| 343 | :installer | ||
| 344 | chain installer-${system}/netboot.ipxe | ||
| 345 | goto start | ||
| 346 | |||
| 347 | :netboot | ||
| 348 | iseq ''${platform} efi && chain --autofree netboot.xyz.efi || chain --autofree netboot.xyz.lkrn | ||
| 349 | goto start | ||
| 350 | |||
| 351 | :memtest | ||
| 352 | iseq ''${platform} efi && chain --autofree memtest.efi || chain --autofree memtest.bin | ||
| 353 | goto start | ||
| 354 | ''} $out/installer-${system}.menu.ipxe | ||
| 355 | ''))) | ||
| 356 | ]; | ||
| 357 | }) ["x86_64-linux"] | ||
| 273 | ) ++ [ | 358 | ) ++ [ | 
| 274 | (let | 359 | (pkgs.runCommandLocal "utils" {} '' | 
| 275 | eostreBuild = (flake.nixosConfigurations.eostre.extendModules { | 360 | mkdir $out | 
| 361 | install -m 0444 -t $out \ | ||
| 362 | ${ipxe}/{ipxe.efi,i386-ipxe.efi,ipxe.lkrn} \ | ||
| 363 | ${pkgs.memtest86plus}/{memtest.efi,memtest.bin} | ||
| 364 | install -m 0444 ${sources.netbootxyz-efi.src} $out/netboot.xyz.efi | ||
| 365 | install -m 0444 ${sources.netbootxyz-lkrn.src} $out/netboot.xyz.lkrn | ||
| 366 | '') | ||
| 367 | (builtins.addErrorContext "while evaluating eostre" (let | ||
| 368 | eostreBuild' = (flake.nixosConfigurations.eostre.extendModules { | ||
| 276 | modules = [ | 369 | modules = [ | 
| 277 | ({ ... }: { | 370 | ({ ... }: { | 
| 278 | config.nfsroot.storeDevice = "10.141.0.1:nix-store"; | 371 | config.nfsroot.storeDevice = "${nfsIp}:nix-store"; | 
| 279 | config.nfsroot.registrationUrl = "http://nfsroot.vidhar.yggdrasil/eostre/registration"; | 372 | config.nfsroot.registrationUrl = "${nfsrootBaseUrl}/eostre/registration"; | 
| 373 | config.system.nixos.label = "eostre"; | ||
| 280 | }) | 374 | }) | 
| 281 | ]; | 375 | ]; | 
| 282 | }).config.system.build; | 376 | }); | 
| 377 | eostreBuild = eostreBuild'.config.system.build; | ||
| 283 | in builtins.toPath (pkgs.runCommandLocal "eostre" {} '' | 378 | in builtins.toPath (pkgs.runCommandLocal "eostre" {} '' | 
| 284 | mkdir -p $out/eostre | 379 | mkdir -p $out/eostre | 
| 285 | install -m 0444 -t $out/eostre \ | 380 | install -m 0444 -t $out/eostre \ | 
| @@ -287,7 +382,39 @@ with lib; | |||
| 287 | ${eostreBuild.kernel}/bzImage \ | 382 | ${eostreBuild.kernel}/bzImage \ | 
| 288 | ${eostreBuild.netbootIpxeScript}/netboot.ipxe \ | 383 | ${eostreBuild.netbootIpxeScript}/netboot.ipxe \ | 
| 289 | ${pkgs.closureInfo { rootPaths = eostreBuild.storeContents; }}/registration | 384 | ${pkgs.closureInfo { rootPaths = eostreBuild.storeContents; }}/registration | 
| 290 | '')) | 385 | install -m 0444 ${pkgs.writeText "eostre.menu.ipxe" '' | 
| 386 | #!ipxe | ||
| 387 | |||
| 388 | set menu-timeout 5000 | ||
| 389 | |||
| 390 | :start | ||
| 391 | menu iPXE boot menu for eostre | ||
| 392 | item eostre ${with eostreBuild'; "${config.system.nixos.distroName} ${config.system.nixos.codeName} ${config.system.nixos.label} (Linux ${config.boot.kernelPackages.kernel.modDirVersion})"} | ||
| 393 | item memtest memtest86plus | ||
| 394 | item netboot netboot.xyz | ||
| 395 | item shell iPXE shell | ||
| 396 | choose --timeout ''${menu-timeout} --default eostre selected || goto shell | ||
| 397 | set menu-timeout 0 | ||
| 398 | goto ''${selected} | ||
| 399 | |||
| 400 | :shell | ||
| 401 | set menu-timeout 0 | ||
| 402 | shell | ||
| 403 | goto start | ||
| 404 | |||
| 405 | :eostre | ||
| 406 | chain eostre/netboot.ipxe | ||
| 407 | goto start | ||
| 408 | |||
| 409 | :netboot | ||
| 410 | iseq ''${platform} efi && chain --autofree netboot.xyz.efi || chain --autofree netboot.xyz.lkrn | ||
| 411 | goto start | ||
| 412 | |||
| 413 | :memtest | ||
| 414 | iseq ''${platform} efi && chain --autofree memtest.efi || chain --autofree memtest.bin | ||
| 415 | goto start | ||
| 416 | ''} $out/eostre.menu.ipxe | ||
| 417 | ''))) | ||
| 291 | ]; | 418 | ]; | 
| 292 | }; | 419 | }; | 
| 293 | }; | 420 | }; | 
| @@ -298,20 +425,12 @@ with lib; | |||
| 298 | after = [ "network.target" ]; | 425 | after = [ "network.target" ]; | 
| 299 | wantedBy = [ "multi-user.target" ]; | 426 | wantedBy = [ "multi-user.target" ]; | 
| 300 | serviceConfig.ExecStart = let | 427 | serviceConfig.ExecStart = let | 
| 301 | ipxe = pkgs.ipxe.override { | ||
| 302 | additionalTargets = { | ||
| 303 | "bin-i386-efi/ipxe.efi" = "i386-ipxe.efi"; | ||
| 304 | }; | ||
| 305 | additionalOptions = [ | ||
| 306 | "NSLOOKUP_CMD" | ||
| 307 | ]; | ||
| 308 | }; | ||
| 309 | tftpRoot = pkgs.runCommandLocal "netboot" {} '' | 428 | tftpRoot = pkgs.runCommandLocal "netboot" {} '' | 
| 310 | mkdir -p $out | 429 | mkdir -p $out | 
| 311 | install -m 0444 -t $out \ | 430 | install -m 0444 -t $out \ | 
| 312 | ${ipxe}/ipxe.efi ${ipxe}/i386-ipxe.efi ${ipxe}/undionly.kpxe | 431 | ${ipxe}/{ipxe.efi,i386-ipxe.efi,ipxe.lkrn} | 
| 313 | ''; | 432 | ''; | 
| 314 | in "${pkgs.atftp}/sbin/atftpd --daemon --no-fork --bind-address=10.141.0.1 ${tftpRoot}"; | 433 | in "${pkgs.atftp}/sbin/atftpd --daemon --no-fork --bind-address=${tftpIp} ${tftpRoot}"; | 
| 315 | }; | 434 | }; | 
| 316 | }; | 435 | }; | 
| 317 | } | 436 | } | 
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 1edae167..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 | ||
| @@ -94,6 +95,8 @@ table inet filter { | |||
| 94 | counter immich-rx {} | 95 | counter immich-rx {} | 
| 95 | counter paperless-rx {} | 96 | counter paperless-rx {} | 
| 96 | counter hledger-rx {} | 97 | counter hledger-rx {} | 
| 98 | counter audiobookshelf-rx {} | ||
| 99 | counter kimai-rx {} | ||
| 97 | 100 | ||
| 98 | counter established-rx {} | 101 | counter established-rx {} | 
| 99 | 102 | ||
| @@ -105,7 +108,7 @@ table inet filter { | |||
| 105 | 108 | ||
| 106 | counter tx-lo {} | 109 | counter tx-lo {} | 
| 107 | 110 | ||
| 108 | counter icmp-ratelimit-gpon-tx {} | 111 | counter icmp-ratelimit-ppp-tx {} | 
| 109 | counter icmp-ratelimit-local-tx {} | 112 | counter icmp-ratelimit-local-tx {} | 
| 110 | counter icmp-tx {} | 113 | counter icmp-tx {} | 
| 111 | 114 | ||
| @@ -125,15 +128,17 @@ table inet filter { | |||
| 125 | counter immich-tx {} | 128 | counter immich-tx {} | 
| 126 | counter paperless-tx {} | 129 | counter paperless-tx {} | 
| 127 | counter hledger-tx {} | 130 | counter hledger-tx {} | 
| 131 | counter audiobookshelf-tx {} | ||
| 132 | counter kimai-tx {} | ||
| 128 | 133 | ||
| 129 | counter tx {} | 134 | counter tx {} | 
| 130 | 135 | ||
| 131 | 136 | ||
| 132 | chain forward_icmp_accept { | 137 | chain forward_icmp_accept { | 
| 133 | 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 | 
| 134 | 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 | 
| 135 | 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 | 
| 136 | 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 | 
| 137 | counter name icmp-fw accept | 142 | counter name icmp-fw accept | 
| 138 | } | 143 | } | 
| 139 | chain forward { | 144 | chain forward { | 
| @@ -146,10 +151,15 @@ table inet filter { | |||
| 146 | 151 | ||
| 147 | iifname lo counter name fw-lo accept | 152 | iifname lo counter name fw-lo accept | 
| 148 | 153 | ||
| 149 | 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 | 
| 150 | 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 | ||
| 151 | 157 | ||
| 152 | 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 | ||
| 153 | 163 | ||
| 154 | 164 | ||
| 155 | 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 | 
| @@ -170,22 +180,22 @@ table inet filter { | |||
| 170 | 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 | 
| 171 | 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 | 
| 172 | 182 | ||
| 173 | 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 | 
| 174 | 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 | 
| 175 | meta l4proto $icmp_protos counter name icmp-rx accept | 185 | meta l4proto $icmp_protos counter name icmp-rx accept | 
| 176 | 186 | ||
| 177 | 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 | 
| 178 | 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 | 
| 179 | 189 | ||
| 180 | 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 | 
| 181 | 191 | ||
| 182 | iifname { lan, yggdrasil } tcp dport 2049 counter name nfs-rx accept | 192 | iifname { lan, yggdrasil } tcp dport 2049 counter name nfs-rx accept | 
| 183 | 193 | ||
| 184 | 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 | 
| 185 | 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 | 
| 186 | 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 | 
| 187 | 197 | ||
| 188 | 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 | 
| 189 | 199 | ||
| 190 | iifname mgmt udp dport 123 counter name ntp-rx accept | 200 | iifname mgmt udp dport 123 counter name ntp-rx accept | 
| 191 | 201 | ||
| @@ -203,6 +213,7 @@ table inet filter { | |||
| 203 | iifname bifrost tcp dport 2283 ip6 saddr $bifrost_surtr counter name immich-rx accept | 213 | iifname bifrost tcp dport 2283 ip6 saddr $bifrost_surtr counter name immich-rx accept | 
| 204 | iifname bifrost tcp dport 28981 ip6 saddr $bifrost_surtr counter name paperless-rx accept | 214 | iifname bifrost tcp dport 28981 ip6 saddr $bifrost_surtr counter name paperless-rx accept | 
| 205 | iifname bifrost tcp dport 5000 ip6 saddr $bifrost_surtr counter name hledger-rx accept | 215 | iifname bifrost tcp dport 5000 ip6 saddr $bifrost_surtr counter name hledger-rx accept | 
| 216 | iifname bifrost tcp dport 28982 ip6 saddr $bifrost_surtr counter name audiobookshelf-rx accept | ||
| 206 | 217 | ||
| 207 | ct state { established, related } counter name established-rx accept | 218 | ct state { established, related } counter name established-rx accept | 
| 208 | 219 | ||
| @@ -220,8 +231,8 @@ table inet filter { | |||
| 220 | 231 | ||
| 221 | oifname lo counter name tx-lo accept | 232 | oifname lo counter name tx-lo accept | 
| 222 | 233 | ||
| 223 | 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 | 
| 224 | 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 | 
| 225 | meta l4proto $icmp_protos counter name icmp-tx accept | 236 | meta l4proto $icmp_protos counter name icmp-tx accept | 
| 226 | 237 | ||
| 227 | 238 | ||
| @@ -254,6 +265,7 @@ table inet filter { | |||
| 254 | iifname bifrost tcp sport 2283 ip6 daddr $bifrost_surtr counter name immich-tx accept | 265 | iifname bifrost tcp sport 2283 ip6 daddr $bifrost_surtr counter name immich-tx accept | 
| 255 | iifname bifrost tcp sport 28981 ip6 daddr $bifrost_surtr counter name paperless-tx accept | 266 | iifname bifrost tcp sport 28981 ip6 daddr $bifrost_surtr counter name paperless-tx accept | 
| 256 | iifname bifrost tcp sport 5000 ip6 daddr $bifrost_surtr counter name hledger-tx accept | 267 | iifname bifrost tcp sport 5000 ip6 daddr $bifrost_surtr counter name hledger-tx accept | 
| 268 | iifname bifrost tcp sport 28982 ip6 daddr $bifrost_surtr counter name audiobookshelf-tx accept | ||
| 257 | 269 | ||
| 258 | 270 | ||
| 259 | counter name tx | 271 | counter name tx | 
| @@ -261,28 +273,28 @@ table inet filter { | |||
| 261 | } | 273 | } | 
| 262 | 274 | ||
| 263 | table inet nat { | 275 | table inet nat { | 
| 264 | counter gpon-nat {} | 276 | counter ppp-nat {} | 
| 265 | # counter container-nat {} | 277 | counter kimai-nat {} | 
| 266 | 278 | ||
| 267 | chain postrouting { | 279 | chain postrouting { | 
| 268 | type nat hook postrouting priority srcnat | 280 | type nat hook postrouting priority srcnat | 
| 269 | policy accept | 281 | policy accept | 
| 270 | 282 | ||
| 271 | 283 | ||
| 272 | meta nfproto ipv4 oifname gpon counter name gpon-nat masquerade | 284 | meta nfproto ipv4 oifname @pppInterface@ counter name ppp-nat masquerade | 
| 273 | # iifname ve-* oifname gpon counter name container-nat masquerade | 285 | iifname ve-kimai oifname @pppInterface@ counter name kimai-nat masquerade | 
| 274 | } | 286 | } | 
| 275 | } | 287 | } | 
| 276 | 288 | ||
| 277 | table inet mss_clamp { | 289 | table inet mss_clamp { | 
| 278 | counter gpon-mss-clamp {} | 290 | counter ppp-mss-clamp {} | 
| 279 | 291 | ||
| 280 | chain postrouting { | 292 | chain postrouting { | 
| 281 | type filter hook postrouting priority mangle | 293 | type filter hook postrouting priority mangle | 
| 282 | policy accept | 294 | policy accept | 
| 283 | 295 | ||
| 284 | 296 | ||
| 285 | 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 | 
| 286 | } | 298 | } | 
| 287 | } | 299 | } | 
| 288 | 300 | ||
| @@ -417,7 +429,7 @@ table inet dscpclassify { | |||
| 417 | chain postrouting { | 429 | chain postrouting { | 
| 418 | type filter hook postrouting priority filter + 1; policy accept | 430 | type filter hook postrouting priority filter + 1; policy accept | 
| 419 | 431 | ||
| 420 | oifname != gpon return | 432 | oifname != @pppInterface@ return | 
| 421 | 433 | ||
| 422 | ip dscp cs0 goto ct_set_cs0 | 434 | ip dscp cs0 goto ct_set_cs0 | 
| 423 | ip dscp lephb goto ct_set_lephb | 435 | ip dscp lephb goto ct_set_lephb | 
