Skip to content

Open container ports to the LAN with firewall drop-ins - #47

Merged
ihavespoons merged 1 commit into
mainfrom
firewall-dropins
Nov 8, 2026
Merged

ihavespoons merged 1 commit into
mainfrom
firewall-dropins

Conversation

@ihavespoons

Copy link
Copy Markdown
Collaborator

The change

  • sibyl.nft includes /etc/nftables/sibyl.d/*.nft in its input chain. An administrator opens a port that a container publishes with one rule file there, such as tcp dport 9000 accept.
  • The image ships only a README in sibyl.d. A local rule file therefore does not stop bootc from updating sibyl.nft.
  • nftables.service starts with /usr/libexec/sibyl/nft-load. If the rules fail to load at boot, the script loads sibyl.nft without the drop-ins, so a bad file cannot leave the host with no firewall.
  • The reload runs nft -f /etc/sysconfig/nftables.conf. The stock reload flushes the whole ruleset, which also drops the rules of other programs such as tailscaled. sibyl.nft starts with destroy table, so the new reload replaces only the sibyl table.
  • The host guide, the troubleshooting guide, the design overview and AGENTS.md describe the directory.

Verification

With nftables in a fedora:44 container:

  • An empty sibyl.d loads, because a glob include that matches no file is not an error.
  • Two rule files load into the input chain. A second load gives the same 2 rules, not 4.
  • A reload with a bad file fails, and the old rules stay.
  • At boot with a bad file, nft-load logs the error and loads the base rules with policy drop and SSH. If the base file is broken too, it exits 1.

The arm64 host image builds. It has the script and the unit drop-in, and bootc container lint passes 14 checks. shellcheck passes.

🤖 Generated with Claude Code

sibyl.nft includes /etc/nftables/sibyl.d/*.nft in its input chain. An
administrator opens a published container port with one rule file there,
and the image ships none, so a local file does not stop bootc from
updating sibyl.nft.

At boot, nft-load falls back to the base rules if a drop-in fails, so one
bad file cannot leave the host without a firewall. The reload now loads
only the sibyl table instead of flushing the whole ruleset, which kept
other programs' rules, such as tailscaled's, from being dropped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ihavespoons
ihavespoons merged commit 0e719a2 into main Nov 8, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant