Skip to content

Instantly share code, notes, and snippets.

@gedge
Created April 10, 2014 06:49
Show Gist options
  • Save gedge/10349046 to your computer and use it in GitHub Desktop.
Save gedge/10349046 to your computer and use it in GitHub Desktop.
--- /usr/local/etc/rc.d/sshguard.20140410070059 2014-04-09 06:24:18.058805000 +0100
+++ /usr/local/etc/rc.d/sshguard 2014-04-10 07:41:48.205562862 +0100
@@ -74,20 +74,23 @@
: ${sshguard_whitelistfile="/usr/local/etc/sshguard.whitelist"}
: ${sshguard_watch_logs="/var/log/auth.log:/var/log/maillog"}
-pidfile=${sshguard_pidfile:-"/var/run/${name}.pid"}
+sshguard_pidfile=${sshguard_pidfile:-"/var/run/${name}.pid"}
command="/usr/sbin/daemon"
actual_command="/usr/local/sbin/${name}"
procname="${actual_command}"
start_precmd="${name}_prestart"
-command_args="-cf ${actual_command} -b ${sshguard_blacklist} ${sshguard_watch_params} -a ${sshguard_safety_thresh} -p ${sshguard_pardon_min_interval} -s ${sshguard_prescribe_interval} -w ${sshguard_whitelistfile} -i ${sshguard_pidfile}"
+command_args="-cf ${actual_command} -b ${sshguard_blacklist} -a ${sshguard_safety_thresh} -p ${sshguard_pardon_min_interval} -s ${sshguard_prescribe_interval} -w ${sshguard_whitelistfile} -i ${sshguard_pidfile}"
sshguard_prestart()
{
mkdir -p `dirname ${sshguard_blacklist##*:}`
[ -e ${sshguard_whitelistfile} ] || touch ${sshguard_whitelistfile}
- sshguard_watch_params=`echo ${sshguard_watch_logs} | tr : \\\n | sed -e s/^/-l\ /g | tr \\\n \ `
+ if [ -n "${sshguard_watch_logs}" ]; then
+ sshguard_watch_params=`echo ${sshguard_watch_logs} | tr : \\\n | sed -e s/^/-l\ /g | tr \\\n \ `
+ command_args="$command_args $sshguard_watch_params"
+ fi
}
run_rc_command "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment