Commit Graph

5 Commits (e0e228ae91737e009397aef883fffcc9f055f9cd)

Author SHA1 Message Date
Michael Orlitzky 78dddb75e6 files/fail2ban-openrc.init.in: add a comment about @RUNDIR@ in the future. 2021-05-14 07:50:34 -04:00
Michael Orlitzky 4d2841832c files/fail2ban-openrc.init.in: don't restart() with a broken config.
This commit adds a new function checkconfig() to the OpenRC service
script. All it does is run the server with the "--test" flag in
addition to the usual command-line arguments.

The new command is not user-facing, but lets us avoid restarting the
daemon with a broken config. That helps when the user changes his
configuration while the daemon is running, and then tries to restart()
not knowing that the new config is broken. A priori, we would stop the
daemon and then the error would only become visible when the subsequent
start() command failed. Refusing to stop() with a broken configuration
is a nicer thing to do.
2021-05-14 07:50:34 -04:00
Michael Orlitzky 87e9cff065 files/fail2ban-openrc.init.in: remove redundant "return" from start_pre.
OpenRC functions will exit with the return code from the last command
by default, so there's no need for the "|| return 1" in our
single-line start_pre() phase.
2021-05-14 07:50:34 -04:00
Michael Orlitzky 36a7abe82f files/fail2ban-openrc.init.in: mention that "reload" doesn't drop bans.
The description of the "reload" OpenRC command just said that it would
reload the configuration, which is true but not totally helpful. This
commit updates it to mention that your existing bans won't be dropped,
in contrast with the "restart" command that does drop your bans.
2021-05-14 07:50:34 -04:00
Michael Orlitzky dd0f348757 files/fail2ban-openrc.init: replace @BINDIR@ at build-time.
This commit renames fail2ban-openrc.init to fail2ban-openrc.init.in,
and replaces the hard-coded value "/usr/bin" with "@BINDIR@"
therein. At build-time, setup.py will replace that string with the
correct value, and rename the file (without the ".in" suffix).

This mimics the procedure done for "fail2ban-service.in" entirely.
2021-05-14 07:50:34 -04:00