I want to find the 403 requests and ban them,here is my log format
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
and my failreg is:
failregex = ^<HOST> -.*"(GET|POST).*.php.*\ 403\ .*$
ignoreregex =
but when I test it using fail2ban-regex command , it returns below
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
could you help me to make a regex to match 403 requests and print the ip out . Thanks in advance