diff options
| author | tv <tv@krebsco.de> | 2026-11-20 10:57:51 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-20 10:57:51 +0000 |
| commit | a623b0d5de4db7d484371ad5bc6af7d4a0a93aa6 (patch) | |
| tree | 438be1a367ae4e5dce06aa58571079acc3bc0d94 /modules | |
| parent | 8e1199c8170968b0561c3bb9bd05cdc6135a15eb (diff) | |
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.
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/host/default.nix | 10 |
1 files changed, 8 insertions, 2 deletions
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 |
