Skip to content

Instantly share code, notes, and snippets.

@svenvarkel
Created January 9, 2018 11:45
Show Gist options
  • Save svenvarkel/bc28f9de660a4d41e7c2b06c7caf1bbf to your computer and use it in GitHub Desktop.
Save svenvarkel/bc28f9de660a4d41e7c2b06c7caf1bbf to your computer and use it in GitHub Desktop.
Poor man's SOCKS proxy via SSH. Add the following lines to your ~/.bash_profile and then socks_on / socks_off
alias socks_on="ssh -D 8666 -C -N -f -M -S ~/.socks.socket $USER@<your_office_gateway>; networksetup -setsocksfirewallproxystate Wi-Fi on;"
alias socks_off="networksetup -setsocksfirewallproxystate Wi-Fi off; ssh -S ~/.socks.socket -O exit $USER@<your_office_gateway>;"
@svenvarkel
Copy link
Author

Add these 2 lines to your ~/.bash_profile. Replace <your_office_gateway> with a real gateway name or IP-address. Create new shell and run socks_off when out of office. Don't forget to run socks_off when back to office.

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