Blueprints · Server Hardening
Zero-Trust
20 min · Linux
Staged nftables allow for SSH and web
Stages an nftables input policy that still accepts SSH on 22 plus HTTP and HTTPS. It is not loaded.
Baked-in protections
- TCP 22 stays accepted
- TCP 80 and 443 stay accepted
- The ruleset is not applied by the bundle
Step 1 · conf
nftables rules
/root/portgate-blueprints/portgate-input.nft
Load this only from a console session. The policy drops other inbound traffic after you apply it yourself.
table inet portgate {
chain input {
type filter hook input priority 0; policy drop;
ct state established,related accept
iif "lo" accept
tcp dport 22 accept
tcp dport 80 accept
tcp dport 443 accept
ip protocol icmp accept
}
}
Step 2 · bash
Read-only check
/root/portgate-blueprints/nft-check.sh
Prints the current ruleset if nft exists. It does not load the staged file.
#!/bin/sh set -eu if command -v nft >/dev/null 2>&1; then nft list ruleset | head -n 40 else echo "nft is not installed. The rules file is staged and was not loaded." fi