1. 在/etc/sysconfig/iptables INPUT规则的前面增加下面的代码
#uncomment the next 3 lines for cc-attack
#-A INPUT -m tcp -p tcp --dport 80 -m state --state NEW -m recent --update --name httpuser --seconds 5 --hitcount 20 -j LOG --log-prefix "cc-attack: " --log-level 4
#-A INPUT -m tcp -p tcp --dport 80 -m state --state NEW -m recent --update --name httpuser --seconds 5 --hitcount 20 -j DROP
#-A INPUT -m tcp -p tcp --dport 80 -m state --state NEW -m recent --name httpuser --set -j RH-Firewall-1-INPUT
2.同时最好修改kernel的ipt_recent模块的参数。在/etc/modprobe.conf增加:
options ipt_recent ip_list_tot=1000 ip_pkt_list_tot=120
本文介绍了一种通过修改iptables规则及内核参数来有效防御HTTP CC攻击的方法。具体操作包括在iptables中增加针对HTTP请求频率的限制规则,并调整了ipt_recent模块参数以提高效率。
1350

被折叠的 条评论
为什么被折叠?



