/etc/fail2ban/filter.d/nginx-noscript.conf
[Definition]
failregex = open\(\) "/\S*(\.php|\.asp|\.exe|\.pl)\S*" failed \(2: No such file or directory\), client: <HOST>,.*
ignoreregex =
/etc/fail2ban/jail.conf
[nginx-iptables]
enabled = true
filter = nginx-noscript
action = iptables[name=nginx, port=81, protocol=tcp]
logpath = /var/log/nginx/*error_log
maxretry = 3
Comente o ignoreip = 127.0.0.1/8
e teste com algumas solicitações inexistentes:
2012/08/10 09:28:11 [error] 3473#0: *27 open() "/var/www/localhost/htdocs/d.pl" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET /d.pl HTTP/1.0", host: "localhost:81"
No /var/log/fail2ban.log
, você verá algo assim:
2012-08-10 09:32:55,234 fail2ban.actions: WARNING [nginx-iptables] Ban 127.0.0.1
Examine o iptables novamente:
Chain fail2ban-nginx (1 references)
pkts bytes target prot opt in out source destination
0 0 DROP all -- * * 127.0.0.1 0.0.0.0/0