Engineering Notes

Minimal Host Egress Filtering with nftables inet Tables

2026-11-12 · Security & Firewall

Inbound default-drop rules protect listening ports, while per-UID egress rules prevent an unprivileged service from probing loopback services, link-local cloud metadata endpoints (169.254.169.254), or RFC 1918 networks.

Validating Before Applying

Always dry-run ruleset syntax with nft -c -f /etc/nftables.conf before loading, and keep an existing SSH management session open until the new ruleset is verified.

Combining with systemd Sandboxing

Pairing nftables with ProtectSystem=strict, PrivateTmp=true, NoNewPrivileges=true, and CapabilityBoundingSet=CAP_NET_BIND_SERVICE limits blast radius cleanly with near-zero runtime overhead.

← Back to notes