Tools
fail2ban jail.local generator
Choose your system and the services you run; the generator writes a commented /etc/fail2ban/jail.local that follows the stock jail definitions and only overrides what it must.
What the generator writes#
The output is a normal jail.local. fail2ban reads it after jail.conf and the files in jail.d/, so anything here wins — see how fail2ban loads its configuration. The generator keeps it short on purpose:
[DEFAULT]holds your ban policy:ignoreip,bantime,findtime,maxretry, optional incremental bans and, if you chose one, thebanaction. On Debian 12/13, Ubuntu 24.04+ and Arch it setsbackend = systemd, because those systems log SSH to the journal.- One section per service with
enabled = true. Ports, log paths, filters and actions come from the stock[jail]definitions injail.conf— which are kept up to date with each fail2ban release — so the file stays valid when fail2ban changes a log path. - Exceptions are explicit. Services that write their own log file (nginx, Apache, FTP servers) get
backend = autoso they read the file even when the default backend is the journal.[recidive]reads/var/log/fail2ban.log. - Docker. With iptables the bans go into the
DOCKER-USERchain (and stay inINPUTfor SSH); with nftables, container jails ban in theforwardhook on all ports. The background is in protecting Docker containers.
Install the file#
sudo nano /etc/fail2ban/jail.local # paste the generated config
sudo fail2ban-client -t # test the configuration
sudo fail2ban-client reload
sudo fail2ban-client statusfail2ban-client -t parses every file and reports errors without touching the running server. If a jail fails with "Have not found any log file", the service isn't installed or logs somewhere else — see no log file found for jail.
Choosing the values#
| Setting | Generator default | Why |
|---|---|---|
bantime |
1h |
Long enough to stop a scripted attack, short enough that a locked-out user recovers. |
findtime |
10m |
The stock default; failures older than this are forgotten. |
maxretry |
5 |
Real users rarely mistype a password five times in ten minutes. |
bantime.increment |
on, factor 1, max 1w |
Each new ban of the same IP lasts twice as long: 1h, 2h, 4h, 8h… up to a week. |
ignoreip |
127.0.0.1/8 ::1 |
Add your own public IP, VPN and LAN so you never ban yourself. |
How long the incremental bans get is easier to see than to calculate — try the bantime calculator. Every option is explained in the jail options reference, and a fully commented production file is on the jail.local example page.
FAQ#
Is the generated jail.local safe to use as-is?#
It only enables stock jails and overrides a few values, so it is a sound starting point — but test it with sudo fail2ban-client -t and check each jail with sudo fail2ban-client status <jail>. Make sure your own IP is in the ignoreip field before you reload.
Why does the generator set backend = auto on some jails?#
On Debian 12/13, Ubuntu 24.04+ and Arch the default backend is the systemd journal. Services such as nginx, Apache and FTP servers write their own log files, and with backend = systemd fail2ban would ignore their logpath. backend = auto makes those jails read the file.
Can I add a service that isn't in the list?#
Yes — add a section by hand with enabled = true, filter, port and logpath. Check the filter library for a built-in filter first; if there isn't one, the filter generator writes one from a log line.
Does the tool send my settings anywhere?#
No. The generator runs entirely in your browser; nothing you type leaves the page.
Spotted something wrong or out of date? Tell us — every page is checked against the current fail2ban release.