fail2ban apache-badbots不阻止IP
我试图让fail2ban阻止某些坏机器人打击我的网站。 我刚刚启用了jail.local中的默认“apache-badbots”(我改变了日志path来匹配我自己的日志和发送报告的用户) enabled = true filter = apache-badbots action = iptables-multiport[name=BadBots, port="http,https"] sendmail-buffered[name=BadBots, lines=5, dest=jisti] logpath = /var/logs/httpd/access_log bantime = 172800 maxretry = 1 我重新启动了fail2ban,并收到一封电子邮件,说监狱已经开始。 然而,当我正在看日志时,其中一个糟糕的机器人攻击了这个网站,fail2ban什么也没做。 所以我检查了filter中的apache-badbots.conf。 我得出结论,正则expression式可能与我使用的自定义日志格式不匹配,也不是实际寻找敲击我的网站的具体的坏bot。 我用failregex修饰,然后用 fail2ban-regex /var/log/httpd/access_log /etc/fail2ban/filter.d/apache-badbots.conf 这个成功报告和300多个匹配。 呜呼我想。 我重新启动了fail2ban。 此后不久,我看到了bot再次锤击该网站,fail2ban无所事事。 我检查了iptables只是为了看看它是否做了什么,但得到的iptables规则错了 iptables -S -P INPUT ACCEPT -P FORWARD ACCEPT -P OUTPUT ACCEPT -N fail2ban-BadBots -N fail2ban-SSH -N fail2ban-php-url-open -A […]