Fetching latest commit…
Cannot retrieve the latest commit at this time
|Failed to load latest commit information.|
This is a set of scripts for OS X that will automatically connect your SSH SOCKS proxy when you switch to a SOCKS-enabled Network Location. Basically, we add a LaunchAgent to detect when your active Network Location profile has changed. If set to a SOCKS-enabled profile, it enables another LaunchAgent to start an autossh session. If changed to a non-SOCKS profile, we disable that LaunchAgent, stopping autossh. Easy peezy. WARNING! If that didn't make sense or you don't understand what these files are doing, then don't use this! This won't work if installed improperly and might do bad things to your machine, kick your dog, and eat your babies. Assumptions: - There is a Network Location that has SOCKS proxying enabled on Airport, localhost:1080 - You have authorized_keys w/ blank passphrase setup on your server see: http://www.thegeekstuff.com/2008/11/3-steps-to-perform-ssh-login-without-password-using-ssh-keygen-ssh-copy-id/ - Requires autossh http://www.harding.motd.ca/autossh/ This can be installed via MacPorts (sudo port install autossh) - autossh uses :31337+31338 for monitoring; won't work if you have Back Orifice installed (har) Setup: - Edit the sshconfig file with your server info - Append sshconfig to your .ssh/config $ cat sshconfig >> ~/.ssh/config - Move the autotunnel script somewhere convenient - Edit local.autotunnel.plist with the location of the script - Copy local.autotunnel.plist to ~/Library/LaunchAgents - Make sure local.autotunnel.autossh.plist is set to what you want - Copy local.autotunnel.autossh.plist to ~/Library/LaunchAgents - Yeah, I don't want to wait until relogin either. Let's see it work! $ launchctl load ~/Library/LaunchAgents/local.autotunnel.plist - Bask in auto-tunneled glory! Alternatives/Background Reading: * http://randomfoo.net/blog/id/3908 * http://richardkmiller.com/925/script-to-enabledisable-socks-proxy-on-mac-os-x * http://codesorcery.net/meerkat this is probably easiest alternative for non-technical users * https://github.com/nicksieger/sheepsafe this looks similar to what I wrote; uses ssh vs autossh; switches locations based on known wifi; runs as daemon; if this switches only after you jump on unknown wireless, doesn't it close the barn doors a bit late for auto-reconnecting apps like Adium?