我在Ubuntu 13.10服务器上有以下的fail2banconfiguration片段:
#jail.conf [apache-getphp] enabled = true port = http,https filter = apache-getphp action = iptables-multiport[name=apache-getphp, port="http,https", protocol=tcp] mail-whois[name=apache-getphp, dest=root] logpath = /srv/apache/log/access.log maxretry = 1 #filter.d/apache-getphp.conf [Definition] failregex = ^<HOST> - - (?:\[[^]]*\] )+\"(GET|POST) /(?i)(PMA|phptest|phpmyadmin|myadmin|mysql|mysqladmin|sqladmin|mypma|admin|xampp|mysqldb|mydb|db|pmadb|phpmyadmin1|phpmyadmin2|cgi-bin) ignoreregex =
我知道正则expression式是好的,因为如果我在我的access.log上运行testing命令:
fail2ban-regex /srv/apache/log/access.log /etc/fail2ban/filter.d/apache-getphp.conf
我得到了一个SUCCESS结果与多个点击,并在我的日志中看到像条目
187.192.89.147 - - [13/Apr/2014:11:36:03 +0100] "GET /phpTest/zologize/axa.php HTTP/1.1" 301 585 "-" "-" 187.192.89.147 - - [13/Apr/2014:11:36:03 +0100] "GET /phpMyAdmin/scripts/setup.php HTTP/1.1" 301 593 "-" "-"
其次,我知道电子邮件configuration正确,因为每次我service fail2ban restart我收到每个filter停止/启动电子邮件。
但是,尽pipe所有这些似乎没有采取任何行动,当其中一个请求进来。没有电子邮件与whois,并没有在iptables中的条目。 什么可能可以防止fail2ban采取行动? (在fail2ban-client -d ,所有内容都按顺序排列,我可以看到链路已经加载了iptables -L )
我有一个类似的问题。 解决scheme出现简单 – 在jail.conf文件中,我有两个类似的监狱 – “Apache”和“Apache多端口”启用。 两个监狱都使用相同的filter和相同的日志文件作为input。 在注释掉监狱之后“Apache Multiport”fail2ban开始正确匹配日志文件中的正则expression式。
PS。 我没有在failregex中使用引号,我正在使用fail2ban 0.9.0.dev。