Skip to content

Instantly share code, notes, and snippets.

@iain17
Last active July 6, 2017 08:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iain17/db79d7f75c52c6f8dfe098765b7850ba to your computer and use it in GitHub Desktop.
Save iain17/db79d7f75c52c6f8dfe098765b7850ba to your computer and use it in GitHub Desktop.
Terminal use proxy (Socks proxy to HTTP proxy)
  1. Setup your socks proxy. In my case I'm creating a socks proxy by creating a secure shell connection (SSH): ssh iain@8.8.4.4 -D 9050

  2. (Optional for mac users): You can also simplify this action by using a lovely (free) application called Secure Pipes: https://www.opoet.com/pyro/

  3. Download delegate and move the executable (dg9_9_13) into /usr/local/sbin or /usr/bin. Example:

cp dg9_9_13/DGROOT/bin/dg9_9_13 /usr/local/sbin/delegate
chmod +x /usr/local/sbin/delegate
  1. Next step is to make sure deleGate will accept HTTP connections on port 9051 and forward to a SOCKS server on port 9050: delegated -P9051 SERVER=http SOCKS=localhost:9050 ADMIN="iain@imunro.nl"

  2. with each terminal instance export the following enviroment variable: http_proxy = http://localhost:9051 and https_proxy = http://localhost:9051 This will make sure that the terminal instance makes use of the http proxy.

  3. (optional) If you use docker. You can set the proxy settings in the GUI. Set these to the internal ip of your machine. For instance http://192.168.0.6:9051. See https://blog.codeship.com/using-docker-behind-a-proxy/ for more info. Note that the ip shown in this screenshot isn't correct. It should be http://{your internal ip}:9051/

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