运行以下测试脚本以查看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 它没有运行我的日志的测试扫描。我已经用类似的语法测试了我的SSH fail2ban设置,并进行了测试。不知道我做错了什么。
发布于 2014-02-18 22:14:27
我认为你遇到的问题是因为壳的膨胀方式。
/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注意,它看到我们传递了一个日志文件。
https://serverfault.com/questions/576597
复制相似问题