Skip to content

Instantly share code, notes, and snippets.

@Jintian
Last active December 11, 2015 00:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jintian/4516418 to your computer and use it in GitHub Desktop.
Save Jintian/4516418 to your computer and use it in GitHub Desktop.
Create ssh tunnel automatically, useful for crossing GFW. If network is down, it will automatically reconnect after network is available.
<?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>
<dict>
<key>NetworkState</key>
<true/>
</dict>
<key>Label</key>
<string>org.openssh.dynamic-proxy</string>
<key>LimitLoadToSessionType</key>
<string>Aqua</string>
<key>OnDemand</key>
<false/>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/ssh</string>
<string>-T</string>
<string>-D7070</string>
<string>-Nn</string>
<string>-C</string>
<string>-c</string>
<string>blowfish</string>
<string>-o</string>
<string>ServerAliveInterval=2</string>
<string>user@ip</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StandardErrorPath</key>
<string>/tmp/sshtunnel.log</string>
<key>StandardOutPath</key>
<string>/tmp/sshtunnel.log</string>
</dict>
</plist>
@Jintian
Copy link
Author

Jintian commented Jan 12, 2013

Installation:

Copy and paste the code into Library/LaunchAgents/org.openssh.dynamic-proxy.plist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment