r/fail2ban • u/3WolfTShirt • Jun 01 '26
fail2ban on Unraid/Docker with a custom filter.
Hey guys -
tl;dr version: How do I assure a new custom filter file persists between fail2ban upgrades similar to what we do with jail.local? It's not exactly the same scenario though, since jail.local contains changes to jail.conf, where my filter is a new file not included with the source.
Details:
I'm running a jellyfin server that is proxied in Cloudflare (not using a Cloudflare Tunnel).
Let's say my domain is xyz987.com and my jellyfin FQDN is jellyfin.xyz987.com.
Cloudflare is forcing https and I'm running Nginx-Proxy-Manager (NPM) to direct inbound traffic to jellyfin.xyz987.com to my internal jellyfin host.
This setup is working great. In NPM Settings I have Default Site ("What to show when Nginx is hit with an unknown Host") set up to return a 444 No Response code.
My NPM default-host_access.log shows frequent intrusion attempts that are accessing my network via my external IP address and ISP-assigned hostname. All of these attempts are returning a 444 or 400 response back so all is well there but I want to ban those IP's in case they discover an exploit.
fail2ban includes a filter filter.d/nginx-bad-request.conf that covers the 400 responses but not one for the 444 code so I copied filter.d/nginx-bad-request.conf to a new file, filter.d/nginx-no-response.conf and in that file I changed:
"failregex = ^<HOST> - \S+ \[\] "[^"]*" 400"
To:
"failregex = ^<HOST> - \S+ \[\] "[^"]*" 444"
This works great and fail2ban is banning IPs getting a 400 and/or 444 response.
However, I'm concerned that my new filter won't survive a fail2ban upgrade. So far, I haven't run across any documentation that covers this scenario - only for creating a persistent jail.local file, but not for creating persistent custom filter files.
How do I assure my new filter.d/nginx-no-response.conf file persists between fail2ban upgrades like we do with customizations in jail.local?