From a623b0d5de4db7d484371ad5bc6af7d4a0a93aa6 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 20 Nov 2026 10:57:51 +0000 Subject: host: only restrict nginx's own packets in chain output The output chain started with meta skuid != "fcbr0-egress" accept, but meta skuid doesn't match packets without a user at all, like those the kernel sends on its own, so they went on to nginx's restrictions. Most are replies (ct established, accepted), but IPv6 neighbour and router discovery (to ff02:: and fe80::) and IGMP (224.0.0.x) aren't, and got rejected as denyDestinations: the host's own IPv6 stopped working. Now only packets of the fcbr0-egress user jump to a chain with nginx's restrictions; everything else passes. --- modules/host/default.nix | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'modules/host') diff --git a/modules/host/default.nix b/modules/host/default.nix index 7f46064..9a40f77 100644 --- a/modules/host/default.nix +++ b/modules/host/default.nix @@ -499,7 +499,7 @@ in { networking.nftables.enable = true; # The build's ruleset check runs where fcbr0-egress doesn't exist. networking.nftables.preCheckRuleset = '' - sed -i 's/skuid != "fcbr0-egress"/skuid != 0/' ruleset.conf + sed -i 's/skuid "fcbr0-egress"/skuid 0/' ruleset.conf ''; networking.nftables.tables.firecracker = { family = "inet"; @@ -587,9 +587,15 @@ ${lib.concatMapStrings (t: '' ${lib.concatMapStrings (t: " ip saddr ${t.ip} limit rate 10/second burst 50 packets log prefix \"fc-egress DENY ${t.user} ${t.name} \" level info\n") taps} reject with icmpx admin-prohibited } + # Only nginx's packets: others, including those the kernel sends on + # its own (ping replies, TCP resets, neighbour discovery; no user, so + # no skuid matches them at all), pass. chain output { type filter hook output priority filter; policy accept; - meta skuid != "fcbr0-egress" accept + meta skuid "fcbr0-egress" jump nginx + } + + chain nginx { ct state { established, related } accept # e.g. to the guests th dport 53 accept fib daddr type local reject -- cgit v1.3.1