Debian 失败2监狱不会检测失败(也不会禁止)
我尝试为fail2ban创建一个自己的过滤器,以检测失败的HTTP身份验证尝试。当使用fail2ban regex进行测试时,它确实可以工作,但不能在运行环境中工作 /etc/fail2ban/jail.localDebian 失败2监狱不会检测失败(也不会禁止),debian,Debian,我尝试为fail2ban创建一个自己的过滤器,以检测失败的HTTP身份验证尝试。当使用fail2ban regex进行测试时,它确实可以工作,但不能在运行环境中工作 /etc/fail2ban/jail.local ... [DEFAULT] bantime = 600 ... [nginx-user-auth] enabled = true filter = nginx-user-auth port = http,https logpath = /var/log/nginx/erro
...
[DEFAULT]
bantime = 600
...
[nginx-user-auth]
enabled = true
filter = nginx-user-auth
port = http,https
logpath = /var/log/nginx/error.log
backend = polling
maxretry = 6
...
/etc/fail2ban/filter.d/nginx-user-auth.conf
[Definition]
failregex = user .*? password mismatch, client: <HOST>
user .*? was not found in .*?, client: <HOST>
ignoreregex =
它还向我显示正确的IP地址和日期/时间
但监狱没有检测到一次失败的登录尝试:
root@debian:~# fail2ban-client status nginx-user-auth
Status for the jail: nginx-user-auth
|- filter
| |- File list: /var/log/nginx/error.log
| |- Currently failed: 0
| `- Total failed: 0
`- action
|- Currently banned: 0
| `- IP list:
`- Total banned: 0
其他监狱运作良好。我完全不知道我在哪里犯的错误
提前谢谢 在这里遇到了您的示例,我从中获得灵感并在我的配置中使用了它,它正在工作。 注意:在第一个正则表达式中,在user.*之后,还要为另一个正则表达式添加第二个failregex后缀 /etc/fail2ban/filter.d/nginx-auth.conf failregex=用户。*?:密码不匹配,客户端: failregex=user.*?在*中找不到,客户端: 监狱状况:nginx auth |-滤器 ||-文件列表:/var/log/nginx/error.log ||-当前失败:0 |`-失败总数:6 `-行动 |-目前被禁止:1 |`-IP列表:x.x.x.x
`-完全禁止:1这可能是由于您安装的fail2ban版本中存在错误造成的。我的Ubuntu 0.8.4版本中发布的fail2ban版本也有同样的问题。从源代码安装fail2ban 0.8.10后,我的nginx过滤器开始工作 fail2ban Github页面上有几个问题提到了这个问题,现在已经解决了
root@debian:~# fail2ban-client status nginx-user-auth
Status for the jail: nginx-user-auth
|- filter
| |- File list: /var/log/nginx/error.log
| |- Currently failed: 0
| `- Total failed: 0
`- action
|- Currently banned: 0
| `- IP list:
`- Total banned: 0