深入了解 fwknop:安全访问与防护的利器
1. fwknop 与 iptables 规则
fwknop 所操作的规则不会与 iptables 策略中的现有规则冲突。在 30 秒计时器到期之前,可在 fwknop 服务器上执行以下命令查看允许访问 SSHD 的 iptables 规则:
[root@spaserver ~]# fwknopd --fw-list [+] Listing chains from IPT_AUTO_CHAIN keywords... Chain FWKNOP_INPUT (1 references) pkts bytes target prot opt in out source destination 11 812 ACCEPT tcp -- * * 204.23.X.X 0.0.0.0/0 tcp dpt:22在这个例子中,fwknop 服务器重新配置了 iptables,允许在 30 秒内访问 SSHD,之后 fwknopd 会从 FWKNOP_INPUT 链中删除该 ACCEPT 规则。虽然大多数 SSH 连接持续时间超过 30 秒,但只要使用 Netfilter 连接跟踪功能,就可以让客户端和服务器之间已建立的 TCP 连接保持打开:
[root@spaserver ~]# iptables -I INPUT 1 -m state --state ESTABLISHED,RELATED -j ACCEPT