Repository navigation
netns-isolation: require the iptables firewall backend - #169
Merged
Merged
Conversation
seberm
approved these changes
Oct 27, 2026
The module builds its iptables commands from networking.firewall.package. With networking.nftables.enable NixOS sets that package to nftables, which has no iptables binary, so nb-netns-bridge failed on its first rule and every netns service stayed down, with nothing to say why. Assert the iptables backend the way the wireguard preset does, and add a configuration check for a netns node with nftables on. Fixes bitcoinix#160
The package is nftables only when networking.nftables is enabled. With the firewalld backend and nftables off it stays iptables, so the message should not claim otherwise. firewalld is simply not supported.
seberm
force-pushed
the
netns-iptables-backend
branch
from
October 27, 2026 22:31
dfac0f3 to
4fcfc9d
Compare
seberm
pushed a commit
that referenced
this pull request
Oct 29, 2026
…bles The assertion from #169 checked networking.firewall.backend only. networking.firewall.package follows networking.nftables.enable, not the backend, so a host with nftables enabled and the backend set to "iptables" by hand passed evaluation and still ran the netns rules with the nftables package, which has no iptables binary. The bridge unit failed and every netns service stayed down. Check networking.nftables.enable as well and add the configuration test for that combination.
seberm
added a commit
that referenced
this pull request
Oct 29, 2026
…175) netns-isolation: check the firewall package the netns rules run with (#175) The assertion from #169 checked networking.firewall.backend only. In the pinned nixpkgs networking.firewall.package follows networking.nftables.enable, not the backend, so a host with nftables on and the backend set to "iptables" by hand passed evaluation and still ran the netns rules with the nftables package. That package has no iptables binary, so nb-netns-bridge failed and every netns service stayed down. The old message even pointed at that setting. The assertion now also requires that the firewall package is not nftables. An explicit networking.firewall.package = pkgs.iptables next to nftables provides the binary and passes, so an operator who keeps the iptables firewall and adds separate nftables tables isn't locked out. The message names that override as the second way out. Two configuration checks cover nftables with the iptables backend (rejected) and the same with pkgs.iptables (accepted). Systems that already evaluated are unchanged; only the broken combination is now refused at evaluation time. Follow-up to #169.
msgilligan
pushed a commit
to msgilligan/bitcoinix
that referenced
this pull request
Nov 8, 2026
…bles The assertion from bitcoinix#169 checked networking.firewall.backend only. networking.firewall.package follows networking.nftables.enable, not the backend, so a host with nftables enabled and the backend set to "iptables" by hand passed evaluation and still ran the netns rules with the nftables package, which has no iptables binary. The bridge unit failed and every netns service stayed down. Check networking.nftables.enable as well and add the configuration test for that combination.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #160.
netns-isolation.nixruns its rules with${config.networking.firewall.package}/bin/iptables. NixOS sets that package topkgs.nftablesas soon asnetworking.nftables.enable = true, and nftables ships no iptables binary, sonb-netns-bridgedied on its first rule and every netns service stayed down with nothing to say why.What changed:
networking.firewall.backend == "iptables", the same check the wireguard preset already has, with a message that says to disablenetworking.nftablesandservices.firewalld. The host firewall may stay off, the netns rules run inside the namespaces and only the natMASQUERADErule touches the host.testNetnsRejectsNftables: a netns node with nftables on must fail with that message. The existingtestNetnsRESTAllowedkeeps checking that the default netns node has no failed assertions.firewalld is rejected too. With firewalld and nftables off the package would still be iptables, so the bridge would probably work, but the preset already treats firewalld as unsupported and the two checks should agree.
Tested
module-configpasses on this branch (30 tests) andtestNetnsRejectsNftablesfails on master with only the test added, both built on x86_64-linux.nix flake checkand the VM scenarios run in CI.Codex (GPT-6 Astra, xhigh) reviewed the commits. It confirmed the option name and the default chain in the pinned nixpkgs firewall module and caught the first message blaming firewalld for the missing binary, fixed in the second commit. DeepSeek V4.1 Flash 1017 (max) and GLM 5.3 (max) audited the tree at 3909bee with Astra as the second opinion, and GLM audited dfac0f3: five and three findings. Two touch netns-isolation.nix and neither is about the assertion. GLM repeats the module's own TODO that service ids aren't checked for uniqueness (line 20), which predates this PR, and Astra adds that a collision would also hand one service the other's source IP allowance. DeepSeek claimed that mempool without the frontend fails to evaluate at line 307. Astra evaluated that configuration with the pinned inputs and marked it a false positive. The rest are #127, #124 and an info note that RTL writes its config with the default umask.