我想找到 403 请求并禁止它们,这是我的日志格式
112.253.6.182 - - [08/Sep/2014:17:42:56 -0400] "GET / HTTP/1.1" 403 579 "baidu" "Mozilla/4.0" 50.117.86.72
106.37.177.251 - - [08/Sep/2014:17:42:56 -0400] "GET /index.php HTTP/1.1" 404 576 "baidu" "Mozilla/4.0" 204.44.65.173
190.254.173.14 - - [08/Sep/2014:17:42:56 -0400] "GET /index.php HTTP/1.1" 404 576 "baidu" "Mozilla/4.0" 204.44.65.173
41.222.196.37 - - [08/Sep/2014:17:42:56 -0400] "GET / HTTP/1.1" 403 579 "baidu" "Mozilla/4.0" 50.117.86.72
我的失败记录是:
failregex = ^<HOST> -.*"(GET|POST).*.php.*\ 403\ .*$
忽略正则表达式 =
但是当我使用 fail2ban-regex 命令对其进行测试时,它会在下面返回
Failregex: 32 total
|- #) [# of hits] regular expression
| 1) [32] ^<HOST> -.*"(GET|POST).*.php.*\ 403\ .*$
`-
Ignoreregex: 0 total
Date template hits:
|- [# of hits] date format
| [3266] Day/MONTH/Year:Hour:Minute:Second
`-
Lines: 3266 lines, 0 ignored, 32 matched, 3234 missed
Missed line(s): too many to print. Use --print-all-missed to print all 3234 lines
你能帮我做一个正则表达式来匹配 403 请求并打印出 ip。提前致谢