# Block all traffic from IP-addresses in the trap ipset
# (with REJECT to facilitate debugging)
iptables -I INPUT 1 -m set --match-set trap src -j REJECT
# Add all IP-addresses to that connect to TCP port 22 to the trap ipset
# (the --timeout value is only necessary when different from the default for the ipset)
iptables -I INPUT 2 -p tcp -m tcp --dport 22 -m set --add-set trap src --timeout 86400 -j SET
# Reject access access to TCP port 22 for everybody
iptables -I INPUT 3 -p tcp -m tcp --dport 22 -j REJECT
firewalld 支持 ipset,并且您在设置该 ipset 时指定 24 小时超时(86400 秒):
在本机 net-filter / iptables 中,必要规则的逻辑和顺序为:
目前,将其转换为本机firewalld/firewall-cmd规则/结构有点超出我的能力,但将规则1和2添加为直接规则应该很容易。
您应该能够通过以下方式获取陷阱列表中的显示条目: