[Definition] # ── NPM access log format (current) ────────────────────────────────────────── # [DD/Mon/YYYY:HH:MM:SS +0000] - STATUS STATUS - METHOD SCHEME HOST "PATH" # [Client REAL_IP] [Length N] [Gzip N] [Sent-to IP] "UA" "REFERER" # # fail2ban strips the timestamp before applying failregex, leaving: # " - STATUS STATUS - METHOD SCHEME HOST "PATH" [Client IP] ... "UA" ..." # # UA appears after [Sent-to ...] so .* is used between and the UA match. # # Test against your logs: # fail2ban-regex /nginx-logs/proxy-host-1_access.log /etc/fail2ban/filter.d/badbot.conf # ───────────────────────────────────────────────────────────────────────────── failregex = - \d+ \d+ - \S+ \S+ \S+ "[^"]*" \[Client \].*"(?i:masscan|zgrab|python-requests|go-http-client/1\.1|nuclei|sqlmap|dirbuster|gobuster|nikto|wfuzz|metasploit|libwww-perl|wpscan|nmap|zmeu|jorgee|shodan\.com|censys|binaryedge|internet-measurement|netcraft|strikeready|dataforseo|semrushbot|ahrefsbot|mj12bot|dotbot)[^"]*" ignoreregex =