小编oja*_*ius的帖子

fail2ban 查找匹配项,但不禁止

我在 CentOS 7 上使用 fail2ban 0.9.7 和 Apache 反向代理,试图禁止机器人尝试以开放代理的身份访问我的服务器,例如:

221.8.179.164 - - [10/Jun/2019:22:04:19 +0200] "CONNECT auth.riotgames.com:443 HTTP/1.1" 405 235 "-" "Mozilla/5.0 (Windows NT 6.1; rv:27.0) Gecko/20100101 Firefox/27.0"
Run Code Online (Sandbox Code Playgroud)

其中一些请求由于某种原因返回 200,尽管ProxyRequests已关闭。

这是我的配置:

apache-badhosts.conf

[Definition]
failregex = ^<HOST> - -.*"(GET|POST|HEAD|CONNECT).*(bad_host_1|bad_host_2|bad_host_3).*"$

ignoreregex =
Run Code Online (Sandbox Code Playgroud)

监狱配置文件

[apache-badhosts]
port     = http,https
# I made sure this is the proper path
logpath  = /var/log/httpd/access_log
bantime  = 172800
maxretry = 1
enabled  = true
Run Code Online (Sandbox Code Playgroud)

这是结果fail2ban-regex

user@host /e/fail2ban> sudo fail2ban-regex /var/log/httpd/access_log /etc/fail2ban/filter.d/apache-badhosts.conf

Running tests
=============

Use …
Run Code Online (Sandbox Code Playgroud)

centos regex fail2ban

6
推荐指数
1
解决办法
2394
查看次数

标签 统计

centos ×1

fail2ban ×1

regex ×1