Created attachment 581150 [details] sshguard openrc script As of commit 32a4676599a900a7a072f66303d9c48b22d1107c in sshguard, the included openrc init script is broken. This is because `command_background=1` will cause the pidfile to be created (adds `--make-pidfile` to arguments), which will then of course fail the `-z $PIDFILE` check in sshguard. Attached a fixed openrc script.
That should say `-e $PIDFILE`, not -z, since it checks whether a file in that path exists of course.
Comment on attachment 581150 [details] sshguard openrc script --- files/sshguard.initd-r1 2018-11-18 11:31:03.091649090 +0100 +++ - 2019-06-28 11:46:12.665458675 +0200 @@ -5,8 +5,7 @@ command="/usr/sbin/sshguard" pidfile="${SSHGUARD_PIDFILE:-/var/run/${SVCNAME}.pid}" command_args="-i \"${pidfile}\" ${SSHGUARD_OPTS}" -command_background=1 -start_stop_daemon_args="--wait ${SSHGUARD_WAIT:-999} --interpreted --quiet" +start_stop_daemon_args="--background --wait ${SSHGUARD_WAIT:-999} --interpreted --quiet" depend() { after iptables Looks like that fixes the `/etc/init.d/sshguard start` and `/etc/init.d/sshguard stop` cases, but `/etc/init.d/sshguard restart` will fail. Maybe it's not waiting long enough? # /etc/init.d/sshguard --nodeps restart * Starting sshguard ... * start-stop-daemon: /usr/sbin/sshguard is already running * Failed to start sshguard [ !! ]
When I set a higher SSHGUARD_WAIT (like 9999 milliseconds) the `restart` case succeeds.
This did not seem necessary in my testing, the service restarted fine with the current default wait time.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dc154eaae27ee058f7c6153df327bd46a540ce50 commit dc154eaae27ee058f7c6153df327bd46a540ce50 Author: Jeroen Roovers <jer@gentoo.org> AuthorDate: 2019-08-08 07:10:59 +0000 Commit: Jeroen Roovers <jer@gentoo.org> CommitDate: 2019-08-08 07:14:04 +0000 app-admin/sshguard: Fix init.d script Package-Manager: Portage-2.3.71, Repoman-2.3.17 Fixes: https://bugs.gentoo.org/688820 Signed-off-by: Jeroen Roovers <jer@gentoo.org> app-admin/sshguard/files/{sshguard.initd-r1 => sshguard.initd-r2} | 5 ++--- app-admin/sshguard/sshguard-2.4.0.ebuild | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-)