I have installed sshguard using homebrew on my Mac OS X machine, but would now like to get sshguard to startup automatically when the system starts up.
I've tried two approaches. Firstly I've tried creating a folder in /Library/StartupItems called sshguard, and created a standard StartupParameters.plist file along with a bash shell script file called sshguard. When I rebooted my machine however, sshguard was never running (I used ps -ax | grep sshguard to check).
The second approach was to create a file named net.sshguard.sshguard in /Library/LaunchDaemons/ with the following XML:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>net.sshguard.sshguard</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/sbin/sshguard</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>UserName</key>
<string>matthew</string>
<key>WorkingDirectory</key>
<string>/usr/local/sbin</string>
</dict>
</plist>
Now when I run launchctl load -w /Library/LaunchDaemons/net.sshguard.sshguard.plist that appears to install the script OK as launchctl list shows that the Daemon script is installed. I then run launchctl start net.sshguard.sshguard and everything appears to be working.
However, when I run ps -ax | grep sshguard I can see that sshguard is not actually running. I've tried rebooting too, and when I then run launchctl list sshguard is not in the list.
If I run sshguard in debug mode SSHGUARD_DEBUG=true /usr/local/sbin/sshguard it appears that it works fine.
And I've checked the permissions of net.sshguard.sshguard.plist and they are the same as the other working files, effectively 775.
Can anyone help advise me on how to get sshguard to startup automatically on a Mac?
Thanks, Matt