iptables利用ipt_recent做防刷限制-创新互联

iptables利用ipt_recent做防刷限制(1分钟内访问超过240次记录日志并丢弃)

成都创新互联公司专注于企业全网整合营销推广、网站重做改版、西湖网站定制设计、自适应品牌网站建设、H5页面制作商城网站建设、集团公司官网建设、外贸网站建设、高端网站制作、响应式网页设计等建站业务,价格优惠性价比高,为西湖等各大城市提供网站开发制作服务。

1、iptables 需支持ipt_recent模块

2、修改 ip_list_tot、ip_pkt_list_tot 限制

chmod 600 /sys/module/ipt_recent/parameters/ip_list_tot
echo 10240 > /sys/module/ipt_recent/parameters/ip_list_tot
chmod 600 /sys/module/ipt_recent/parameters/ip_pkt_list_tot
echo 500 > /sys/module/ipt_recent/parameters/ip_pkt_list_tot

3、建立iptables syslog 日志

#编辑/etc/syslog.conf 添加以下行

kern.=debug    /var/log/firewall/http_access.log
#新建日志目录
mkdir /var/log/firewall/
#重启服务
/etc/init.d/syslog restart

4、建立iptables策略

#建立记录表
iptables -I INPUT -p tcp --dport 80 -d 192.168.160.44 \
 -m state --state NEW -m recent --name httpuser --set
#超过限制记录日志
iptables -A INPUT -m recent --update --name httpuser --seconds 60 \
 --hitcount 240 -j LOG --log-level 5 --log-prefix 'HTTP attack: '
#超过限制DROP
iptables -A INPUT -m recent --update --name httpuser --seconds 60 \
 --hitcount 240 -j DROP
#注:查看httpuser记录 /proc/net/ipt_recent/httpuser

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


当前名称:iptables利用ipt_recent做防刷限制-创新互联
网页地址:http://scyanting.com/article/cccjss.html