【发布时间】:2020-01-29 04:43:09
【问题描述】:
我想通过 fail2ban 禁止任何人在我的 nginx error.log 文件中生成这两种类型的行:
2019/12/15 20:12:12 [error] 640#640: *6 open() "/data/xxxxxx.com/www/50x.html" failed (2: No such file or directory), client: 35.187.45.148, server: xxxxxx.com, request: "GET /external.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock", host: x.x.x.x
2019/12/16 13:42:59 [crit] 647#647: *41 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 35.233.78.55, server: xxxxxx.com, request: "GET /external.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "x.x.x.x"
我认为这些行会起作用:
open() .* 客户端:
connect() 到 .* 客户端:
但他们显然没有(用 fail2ban-regex 测试)。这是我的完整过滤器:
[Definition]
failregex = open() .* client: < HOST >
connect() to .* client: < HOST >
FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: < HOST >
datepattern = {^LN-BEG}
注意:最后一个(FastCGI...)确实有效。 “.*”会有什么问题吗?
【问题讨论】: