运行以下testing脚本查看Fail2ban是否正在工作:
fail2ban-regex /var/log/apache*/*access.log /etc/fail2ban/filter.d/apache-auth.conf
我得到这个回应:
Running tests ============= Use ignoreregex line : /etc/fail2ban/filter.d/apache-badbots No section headers in /var/log/apache2/other_vhosts_access.log
它没有运行我的日志的testing扫描。 我已经用类似的语法testing了我的SSH fail2ban设置,并且testing正常。 不知道我在做什么错。
我认为你遇到的问题是因为shell的扩展方式
/var/log/apache*/*access.log
而且我假设你的意思/etc/fail2ban/filter.d/apache-auth.conf 。
尝试把单引号围绕该参数
fail2ban-regex '/var/log/apache*/*access.log' /etc/fail2ban/filter.d/apache-auth.conf
这将通过它未扩展到fail2ban-regex 。
进一步的研究 – 看起来不像fail2ban-regex需要通配符:
fail2ban-regex '/var/log/apache*/*access.log' /etc/fail2ban/filter.d/apache-auth.conf ... Use regex file : /etc/fail2ban/filter.d/apache-auth.conf Use single line: /var/log/apache*/*access.log
请注意,它认为我们正在传递一行,然后尝试
fail2ban-regex /var/log/apache2/access.log /etc/fail2ban/filter.d/apache-auth.conf ... Use regex file : /etc/fail2ban/filter.d/apache-auth.conf Use log file : /var/log/apache2/access.log
注意它看到我们已经通过了一个日志文件。