[英]No matches in fail2ban regex
我正在使用fail2ban尝试阻止任何获得多次失败登录的IP,失败登录在我们的应用程序日志中记录为“ /login.html?success=no”。
所以我创建了一个fail2ban .conf,但是找不到它的匹配项,但是当我使用此站点时,它会突出显示该行。 我的.conf看起来像这样:
[Definition]
failregex = .*<HOST>.*login\.html\?success=no
ignoreregex =
但是,当我运行“ fail2ban-regex”进行测试时,找不到任何匹配项:
fail2ban-regex test.log /etc/fail2ban/filter.d/nginx-test.conf
Results
=======
Failregex: 0 total
Ignoreregex: 0 total
我正在使用的日志文件如下所示:
| 2017/10/03 10:11:53 [error] 14870#14870: *51 access forbidden by rule, client: 1.2.3.4, server: example.com, request: "GET /robots.txt HTTP/1.1", host: "example.com"
| 2017/10/03 10:11:53 [warn] 14870#14870: *50 delaying request, excess: 0.545, by zone "base", client: 1.2.3.4, server: example.com, request: "GET /login.html?success=no HTTP/1.1", host: "example.com", referrer: "https://example.com/"
我的正则表达式必须是:
.*client: <HOST>.*request: "GET \\/login\\.html\\?success=no HTTP/1.1"
感谢@melpomene向我指出了正确的方向,我的<HOST>
甚至都没有指向IP。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.