Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Automatically connects your Mac to ssh SOCKS proxy when switching to SOCKS-enabled Network Location
tree: a03b174cda

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.

- There is a Network Location that has SOCKS proxying enabled on Airport,
- You have authorized_keys w/ blank passphrase setup on your server
- Requires 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)

- 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:
  this is probably easiest alternative for non-technical users
  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?
Something went wrong with that request. Please try again.