您好,登錄后才能下訂單哦!
iptables利用ipt_recent做防刷限制(1分鐘內(nèi)訪問(wèn)超過(guò)240次記錄日志并丟棄)
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/ #重啟服務(wù) /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 #超過(guò)限制記錄日志 iptables -A INPUT -m recent --update --name httpuser --seconds 60 \ --hitcount 240 -j LOG --log-level 5 --log-prefix 'HTTP attack: ' #超過(guò)限制DROP iptables -A INPUT -m recent --update --name httpuser --seconds 60 \ --hitcount 240 -j DROP #注:查看httpuser記錄 /proc/net/ipt_recent/httpuser
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。