深入探索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