~kris/dots

srice

srice/doc/networking/host-hardening/nftables.md -rw-r--r-- 1.6 KiB
e98f3b03 — Kris Yotam chore: sync local state after restore (push updates, no pull) a month ago

#nftables

Replaces iptables. Use for all new Linux deployments.

#Default Deny Configuration

table inet filter {
    chain input {
        type filter hook input priority 0; policy drop;
        ct state established,related accept
        iif lo accept
        # specific allow rules here
    }
    chain forward {
        type filter hook forward priority 0; policy drop;
    }
    chain output {
        type filter hook output priority 0; policy drop;
        ct state established,related accept
        # explicit egress rules here
    }
}

Egress filtering on output is critical and almost universally neglected. Malware, data exfil, and C2 all depend on unrestricted outbound access. Whitelist only ports/destinations your system actually needs.

#Key Concepts

  • Stateful inspection: ct state established,related
  • Sets and maps: efficient matching against large lists
  • Deep packet inspection: Layer 7 content inspection
  • Geo-IP blocking: via sets with IP ranges
  • Rate limiting: per-address connection limits
  • Connection tracking: ct state tracking

#References