使用iptables,如何限制IP范围和浏览器字符串的连接?

问题描述 投票:-2回答:1

每天一次,以下IP范围每秒发送多个请求。在攻击期间,使用了一个奇怪的浏览器,如下所述:

IP Range: 192.168.1.100-192.168.1.200
Port: 80 (Apache web server)   
Browser Name: X11: Crawler

在其他时候,我从提到的IP愤怒接收合法流量(与其他浏览器)。因此,我无法完全阻止此IP范围。

我想将聚合连接(仅提到的IP范围)限制为15 /分钟。以下iptable规则是否正确?

iptables -A INPUT -p tcp --syn  --dport 80    
-m string    --algo bm --string "X11: Crawler"  \    
-m iprange   --src-range 192.168.1.100-192.168.1.200  \    
-m connlimit --connlimit-above 15/minute --connlimit-mask 32  \    
-j REJECT --reject-with tcp-reset 
linux iptables web-application-firewall
1个回答
0
投票

我认为这工作

iptables -A INPUT -p tcp --destination-port 80 -m iprange --src-range 192.168.1.100-192.168.1.200 -j ACCEPT

如果你想要禁止的IP范围改变ACCEPT与DROP

© www.soinside.com 2019 - 2024. All rights reserved.