| 加固项 | 防火墙后端现代化 |
|---|---|
| 适用平台 | Linux(nftables) |
| 风险等级 | 中 |
| 基线 | 规则集显式持久化 |
查看与应用
查看与应用
nft list ruleset
nft -f /etc/nftables.conf
systemctl enable --now nftables
nft list ruleset > /root/nft-backup-$(date +%F).ruleset最小骨架示例
最小骨架示例
table inet filter {
chain input { type filter hook input priority 0; policy drop;
ct state established,related accept
iif lo accept
tcp dport 22 accept
tcp dport 443 accept
tcp dport 80 accept
}
chain forward { type filter hook forward priority 0; policy drop; }
chain output { type filter hook output priority 0; policy accept; }
}同一台机器上不要混用 nft 与 iptables 命令改同一规则集:两套前端各自记账,容易互相覆盖。