溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

iptables利用ipt_recent做防刷限制

發(fā)布時(shí)間:2020-06-13 14:29:11 來(lái)源:網(wǎng)絡(luò) 閱讀:989 作者:fayong_zhou 欄目:安全技術(shù)

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


向AI問(wèn)一下細(xì)節(jié)

免責(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)容。

AI