Commit Graph

6 Commits (e0e228ae91737e009397aef883fffcc9f055f9cd)

Author SHA1 Message Date
Yaroslav Halchenko e96ecf78c1 [DATALAD RUNCMD] Do interactive fixing of some ambigous typos
=== Do not change lines below ===
{
 "chain": [],
 "cmd": "codespell -w -i 3 -C 2 ./files/fail2ban-openrc.conf ./fail2ban/tests/fail2banclienttestcase.py",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^
2023-11-16 10:59:16 -05:00
Michael Orlitzky 4e7419e71f files/fail2ban-openrc.conf: add back the "-x" example.
I've removed the stale socket cleanup from our OpenRC service script:

  * Cleaning up stale sockets isn't really the job of the service script.
  * The ability to ignore a stale socket is already built into the server.

With it gone, maybe the "-x" is a useful example to have in the conf
file (although it's commented-out by default, anyway).
2021-05-14 07:38:00 -04:00
Michael Orlitzky 654fda8a50 files/fail2ban-openrc*: let start-stop-daemon manage the server.
There are two ways that it would make sense to write the OpenRC
service script for fail2ban:

  1. Use the fail2ban-client program to stop, start, reload, etc. the
     server; and try to figure out whether or not it worked afterwards.

  2. Use the start-stop-daemon program built into OpenRC to manage the
     fail2ban-server process. This works only for starting and stopping,
     because the "reload" command is sent over an undocumented protocol,
     but has the benefit that you get immediate feedback about the result
     of calling fail2ban-server.

The existing service script combined the two in a way that appeared to
work, but didn't make too much sense. It used start-stop-daemon to
initiate the fail2ban-client program with either a "start" or "stop"
argument. So long as everything goes fine, that appears to work. But
the start-stop-daemon is not actually monitoring the fail2ban-client
program; it's supposed to be monitoring the fail2ban-server process
that gets started as side-effect.

The existing stop() function does not do quite what you'd expect; for
example the "stop" command is never sent. Again, the daemon does
ultimately get stopped so long as the hard-coded PID file contains
what you think it does -- so it "works" -- but is misleading.

This commit changes everything to use the second approach above, where
start-stop-daemon manages everything. This was done mainly to simplify
the service script, because now the default start() and stop() phases
can be used, allowing us to delete them from our copy. One might worry
that there is some special magic behind "fail2ban-client start" and
"fail2ban-client stop", however that does not appear to be the
case. Admittedly, if in the future those two commands begin to do
something nonstandard, the service script would need to be changed
again to take the first approach above and use fail2ban-client for
everything.
2021-05-14 07:38:00 -04:00
Michael Orlitzky eb58e90ba9 files/fail2ban-openrc.conf: remove a commented example setting.
Our OpenRC conf file already tells users how to find the available
options that can be placed in the FAIL2BAN_OPTIONS variable, so having
a specific example of,

 FAIL2BAN_OPTIONS="-x"

doesn't provide much more information. In fact, it makes you wonder
why it's there in the first place: does the init script have some kind
of problem with stale sockets? It used to, but that problem has been
fixed. This commit removes the redundant example.
2018-07-15 09:17:29 -04:00
Michael Orlitzky 1cec3d05b8 files/fail2ban-openrc.conf: remove hard-coded paths.
There were two paths mentioned in comments in the fail2ban OpenRC conf
file, but those paths aren't guaranteed to be correct (until/unless we
integrate the conf file with the build system).

The first comment referenced the physical location of the associated
init script, and in my opinion is not useful to an end user in the
first place. It has been removed: OpenRC users know what this file
is for, there's no reason to repeat it in a comment.

The second comment contained an absolute path to fail2ban-client, and
I've removed the leading path components because "fail2ban-client" is
generally run from your $PATH.
2018-07-15 09:11:53 -04:00
Michael Orlitzky 884f708bd7 fail2ban/files: rename "gentoo" files to "openrc".
We ship a service script and configuration file for "gentoo" that are
actually more generally applicable: they work on any system where
OpenRC is used. This commit simply renames the files from "gentoo" to
"openrc" to reflect the fact that they are in no way Gentoo-specific.
2018-07-15 09:07:28 -04:00