From 0329cbde6fe7105ca6e620be421fb4b888ae2029 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 3 Dec 2026 03:08:37 +0000 Subject: ne: configure hrm.nftables directly --- systems/ne/config.nix | 57 ++++++++++++++++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 19 deletions(-) (limited to 'systems') diff --git a/systems/ne/config.nix b/systems/ne/config.nix index 755a90fc..128683d3 100644 --- a/systems/ne/config.nix +++ b/systems/ne/config.nix @@ -82,14 +82,18 @@ prefixLength = config.krebs.build.host.nets.internet.ip6.prefixLength; } ]; - tv.iptables.extra6.filter.INPUT = [ - # Allow Neighbor Discovery - # https://en.wikipedia.org/wiki/Neighbor_Discovery_Protocol - "-p icmpv6 --icmpv6-type 133 -j ACCEPT" - "-p icmpv6 --icmpv6-type 134 -j ACCEPT" - "-p icmpv6 --icmpv6-type 135 -j ACCEPT" - "-p icmpv6 --icmpv6-type 136 -j ACCEPT" - ]; + # Allow Neighbor Discovery + # https://en.wikipedia.org/wiki/Neighbor_Discovery_Protocol + hrm.nftables.tables.filter.chains.input.rules.neighbor-discovery-all = { + order = 1500; + icmpv6.type = [ + "nd-router-solicit" + "nd-router-advert" + "nd-neighbor-solicit" + "nd-neighbor-advert" + ]; + verdict = "accept"; + }; }) # wiregrill configuration @@ -99,16 +103,31 @@ imports = [ ../../configs/wiregrill.nix ]; - tv.iptables.extra4.nat.POSTROUTING = [ "-s 10.244.3.0/24 ! -d 10.244.3.0/24 -j MASQUERADE" ]; - tv.iptables.extra6.nat.POSTROUTING = [ "-s 42:1::/32 ! -d 42:1::/32 -j MASQUERADE" ]; - tv.iptables.extra6.filter.FORWARD = [ - "-s ${config.krebs.hosts.pi.nets.wiregrill.ip6.addr} -j ACCEPT" - "-s 42:1:a46e::/48 -j ACCEPT" # tv - ]; - tv.iptables.extra4.filter.FORWARD = [ - "-i wiregrill -o retiolum -j ACCEPT" - "-i retiolum -o wiregrill -j ACCEPT" - ]; + hrm.nftables.tables.nat.chains.postrouting.rules = { + wiregrill-masquerade-ipv4.text = + "ip saddr 10.244.3.0/24 ip daddr != 10.244.3.0/24 masquerade"; + wiregrill-masquerade-ipv6.text = + "ip6 saddr 42:1::/32 ip6 daddr != 42:1::/32 masquerade"; + }; + hrm.nftables.tables.filter.chains.forward.rules = { + wiregrill-out = { + saddr = [ + config.krebs.hosts.pi.nets.wiregrill.ip6.addr + "42:1:a46e::/48" # tv + ]; + verdict = "accept"; + }; + wiregrill-to-retiolum = { + iifname = "wiregrill"; + oifname = "retiolum"; + verdict = "accept"; + }; + retiolum-to-wiregrill = { + iifname = "retiolum"; + oifname = "wiregrill"; + verdict = "accept"; + }; + }; }) # Nginx configuration @@ -130,7 +149,7 @@ add_header Strict-Transport-Security 'max-age=31536000; includeSubDomains; preload' always; ''; - tv.iptables.input-internet-accept-tcp = [ + hrm.nftables.input.internet.tcp = [ "http" "https" ]; -- cgit v1.3.1 [cgit] Unable to lock slot /tmp/cgit/5c300000.lock: Permission denied (13)