The main entry point now notifies Reload Fail2Ban when jail.local changes, as service_jail already did, instead of restarting the daemon. A restart stops every jail, which flushes its bans out of the firewall until they are restored from Fail2Ban's database when the jail starts again, and forgets failures counted toward maxretry. A reload applies the new settings to the running jails and does neither. state: reloaded starts the service when it is not running, so a first install still works. fail2ban-client -t still runs before the reload when the whole role runs.
Following your comment on #157 (handler names are not part of the interface), the Restart Fail2Ban handler is removed: nothing in the role notifies it any more, and no other role of the collection does either (searched the whole repository).
The issue's open question (does any setting the role writes need a restart?): no, none that the role writes. From the Fail2Ban 1.1.0 source: a reload re-reads jail.local, jail.d and filter.d and re-applies each jail's ignoreip, filters and journalmatch; a changed backend restarts that jail by itself; server-level settings (loglevel, dbfile, socket, pidfile) are not reloaded, and the role writes none of them. Three differences from the old restart are now stated in the README: a reload does not unban an address that a widened fail2ban_ignoreip newly covers (only a restart skips ignored addresses when it restores bans; fail2ban-client unban <address> releases it), it does not change existing bans when bantime changes, and with --tags fail2ban_configure only, the configuration test does not run first (the reload still rejects a bad configuration).
Verified
All commit-stage hooks pass (yamllint, ansible-lint, REUSE, changelog lint, Conventional Commit); --syntax-check passes on the converge, verify and side_effect playbooks.
Molecule: side_effect.yml records the daemon's PID, bans 198.51.100.77, and rewrites jail.local with maxretry: 4; verify.yml asserts the new maxretry is active, the ban is in force and the PID is unchanged. The PID is what separates a reload from a restart, because bans come back from the database after a restart.
The ignored-address behaviour of the restart path was checked in the Fail2Ban 1.1.0 source (Jail.restoreCurrentBans skips ignored addresses; Server.reloadJails unbans only with --unban).
An independent review of the diff, no blocking finding; its documentation findings are applied.
Not verified
Molecule itself (CI only): the side_effect and verify steps have not run on the image. They rely on ExecReload=fail2ban-client reload keeping MainPID (read from the upstream unit, not checked against the Ubuntu 24.04 package unit).
The reload on a real host running a changed jail, and the three differences above: read from the source, not run.
I confirm third-party material is recorded in NOTICE and REUSE.toml, or there is none.
Assisted-by: Claude Code
## What and why
Closes #157
The main entry point now notifies `Reload Fail2Ban` when `jail.local` changes, as `service_jail` already did, instead of restarting the daemon. A restart stops every jail, which flushes its bans out of the firewall until they are restored from Fail2Ban's database when the jail starts again, and forgets failures counted toward `maxretry`. A reload applies the new settings to the running jails and does neither. `state: reloaded` starts the service when it is not running, so a first install still works. `fail2ban-client -t` still runs before the reload when the whole role runs.
Following your comment on #157 (handler names are not part of the interface), the `Restart Fail2Ban` handler is removed: nothing in the role notifies it any more, and no other role of the collection does either (searched the whole repository).
**The issue's open question** (does any setting the role writes need a restart?): no, none that the role writes. From the Fail2Ban 1.1.0 source: a reload re-reads `jail.local`, `jail.d` and `filter.d` and re-applies each jail's `ignoreip`, filters and `journalmatch`; a changed `backend` restarts that jail by itself; server-level settings (`loglevel`, `dbfile`, `socket`, `pidfile`) are not reloaded, and the role writes none of them. Three differences from the old restart are now stated in the README: a reload does not unban an address that a widened `fail2ban_ignoreip` newly covers (only a restart skips ignored addresses when it restores bans; `fail2ban-client unban <address>` releases it), it does not change existing bans when `bantime` changes, and with `--tags fail2ban_configure` only, the configuration test does not run first (the reload still rejects a bad configuration).
## Verified
- All commit-stage hooks pass (yamllint, ansible-lint, REUSE, changelog lint, Conventional Commit); `--syntax-check` passes on the converge, verify and side_effect playbooks.
- Molecule: `side_effect.yml` records the daemon's PID, bans `198.51.100.77`, and rewrites `jail.local` with `maxretry: 4`; `verify.yml` asserts the new `maxretry` is active, the ban is in force and the PID is unchanged. The PID is what separates a reload from a restart, because bans come back from the database after a restart.
- The ignored-address behaviour of the restart path was checked in the Fail2Ban 1.1.0 source (`Jail.restoreCurrentBans` skips ignored addresses; `Server.reloadJails` unbans only with `--unban`).
- An independent review of the diff, no blocking finding; its documentation findings are applied.
## Not verified
- Molecule itself (CI only): the side_effect and verify steps have not run on the image. They rely on `ExecReload=fail2ban-client reload` keeping `MainPID` (read from the upstream unit, not checked against the Ubuntu 24.04 package unit).
- The reload on a real host running a changed jail, and the three differences above: read from the source, not run.
---
- [x] I confirm third-party material is recorded in `NOTICE` and `REUSE.toml`, or there is none.
Assisted-by: Claude Code
The main entry point notified a restart. A restart stops every jail, which
flushes its bans out of the firewall until they are restored from Fail2Ban's
database when the jail starts again, and forgets failures counted toward
maxretry. A reload applies the new settings to the running jails. service_jail
already reloads.
The Restart Fail2Ban handler is removed: nothing notifies it any more, and a
handler name is not part of the role's interface (#257). A new side_effect.yml
bans an address, records the daemon's PID and rewrites jail.local; verify
asserts the new maxretry is active, the ban is in force and the PID is
unchanged (the PID is what separates a reload from a restart, since bans are
restored from the database).
Assisted-by: Claude Code
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
What and why
Closes #157
The main entry point now notifies
Reload Fail2Banwhenjail.localchanges, asservice_jailalready did, instead of restarting the daemon. A restart stops every jail, which flushes its bans out of the firewall until they are restored from Fail2Ban's database when the jail starts again, and forgets failures counted towardmaxretry. A reload applies the new settings to the running jails and does neither.state: reloadedstarts the service when it is not running, so a first install still works.fail2ban-client -tstill runs before the reload when the whole role runs.Following your comment on #157 (handler names are not part of the interface), the
Restart Fail2Banhandler is removed: nothing in the role notifies it any more, and no other role of the collection does either (searched the whole repository).The issue's open question (does any setting the role writes need a restart?): no, none that the role writes. From the Fail2Ban 1.1.0 source: a reload re-reads
jail.local,jail.dandfilter.dand re-applies each jail'signoreip, filters andjournalmatch; a changedbackendrestarts that jail by itself; server-level settings (loglevel,dbfile,socket,pidfile) are not reloaded, and the role writes none of them. Three differences from the old restart are now stated in the README: a reload does not unban an address that a widenedfail2ban_ignoreipnewly covers (only a restart skips ignored addresses when it restores bans;fail2ban-client unban <address>releases it), it does not change existing bans whenbantimechanges, and with--tags fail2ban_configureonly, the configuration test does not run first (the reload still rejects a bad configuration).Verified
--syntax-checkpasses on the converge, verify and side_effect playbooks.side_effect.ymlrecords the daemon's PID, bans198.51.100.77, and rewritesjail.localwithmaxretry: 4;verify.ymlasserts the newmaxretryis active, the ban is in force and the PID is unchanged. The PID is what separates a reload from a restart, because bans come back from the database after a restart.Jail.restoreCurrentBansskips ignored addresses;Server.reloadJailsunbans only with--unban).Not verified
ExecReload=fail2ban-client reloadkeepingMainPID(read from the upstream unit, not checked against the Ubuntu 24.04 package unit).NOTICEandREUSE.toml, or there is none.Assisted-by: Claude Code