Mac OS X persistent phone home ssh tunnel

Here’s my version of SSH Reverse Tunnel on Mac OS X.

collins-MacBook-Pro:~ collin$ cat /Library/LaunchDaemons/phonehome.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key><string>phonehome</string>
<key>ProgramArguments</key><array>
<string>ssh</string>
<string>-NTC</string>
<string>-o ServerAliveInterval=60</string>
<string>-o ExitOnForwardFailure=yes</string>
<string>-R 22750:localhost:22</string>
<string>-L 3306:localhost:3306</string>
<string>my-domain.com</string>
</array>
<key>UserName</key><string>collin</string>
<key>RunAtLoad</key><true/>
<key>KeepAlive</key><true/>
</dict>
</plist>

Install by running:

sudo launchctl load /Library/LaunchDaemons/phonehome.plist

Advertisements