iptables -t filter -A "input_wan" -p "tcp" --dport 22 -m recent --set --name SSH_CHECK
iptables -t filter -A "input_wan" -m recent --update --seconds 300 --hitcount 10 --name SSH_CHECK -j DROP
指令格式
iptables -t filter -A "input_wan" 規則:新增規則到 filter 表格的 input_wan 鏈
使用 xt_recent 模組建立兩個規則,前者將 TCP port 22 連線的來源 IP 位址紀錄到名為 SSH_CHECK 的列表。後者更新列表,找出最近 300 秒內出現 10 次以上的連線,drop 掉它
/proc/net/xt_recent/* 可看或設定列表
http://snowman.net/projects/ipt_recent/ 有其它例子,詳細說明可見 `man iptables`
延伸閱讀
- iptables (本站)
沒有留言:
張貼留言