CentOS 6 fail2ban未能禁止http dos请求

Fail2ban无法禁止通过HTTP发送过多请求的客户端。 SSH禁令确实工作正常

为了testing这个,我使用abcurl从其他服务器进行了多个testing。 我甚至确定我被ssh禁止。 我成功了,但我没有成功的HTTP请求。

 ab -n 600 -c 10 http://domain.tld/ 

我已经尝试了几个filter的正则expression式规则,在testingapache日志的一部分时工作正常。 我有以下结果:

 tail -n 10000 /var/log/httpd/<vhost>_access.log > /tmp/f2btest.log fail2ban-regex /tmp/f2btest.log /etc/fail2ban/filter.d/cybertec-ban.conf 

结果如下:

 Running tests ============= Use failregex file : /etc/fail2ban/filter.d/custom-ban.conf Use log file : /tmp/f2btest.log Results ======= Failregex: 9583 total |- #) [# of hits] regular expression | 1) [9583] ^<HOST> -.*\"(GET|POST).* `- Ignoreregex: 0 total Date template hits: |- [# of hits] date format | [10000] Day/MONTH/Year:Hour:Minute:Second `- Lines: 10000 lines, 0 ignored, 9583 matched, 417 missed Missed line(s): too many to print. Use --print-all-missed to print all 417 lines 

我认为问题不在输出。 请告诉我,如果我错了。

我把规则放入jail.conf ,规则如下所示:

 # # Filter malicious http requests # [custom-ban] enabled = true port = http,https filter = custom-ban action = iptables[name=HTTP, port=http, protocol=tcp] iptables[name=HTTPS, port=https, protocol=tcp] logpath = /var/log/httpd/*access.log # <- this works according to the fail2ban log /var/log/httpd/access_log maxretry = 500 findtime = 120 

custom-banfilter(位于/etc/fail2ban/filter.d/中)如下所示:

 [Definition] failregex = ^<HOST> -.*\"(GET|POST).* ignoreregex = 

我在做什么错了? 我忘了什么? 我怎样才能使这些规则工作?

有名字相撞吗?

你的maxretry设置为500findtime设置为120所以一个IP地址必须在120秒内生成500条相关消息才能被禁止。

我不知道你的系统,它受到什么攻击,有多快甚至什么是正常的。 从外面看,他们似乎有点高,试着减lessmaxretry。