Setting up a SOCKS proxy using SSH on a cloud instance

A generic HTTP proxy can be created using a Catalyst Cloud instance. This proxy utilises the native SOCKS5 support in OpenSSH.

Establishing the SOCKS proxy

On Linux

In a terminal, connect to your instance using SSH with dynamic port forwarding enabled:

ssh -D 6676 tunnel@[ip]

You should leave this SSH session established while using the proxy.

Now, your browser needs to be configured to use this tunnel as a proxy. The procedure varies per browser and is described below for Firefox and Chrome.

Firefox

In your browser, change its proxy settings (under Preferences, Advanced, Network, Settings) to use the cloud-tunnel as a SOCKS proxy, as per the example below:

../../_images/ct-firefox-proxy.png

Chrome

In your browser, enter the URL chrome://settings/search#proxy and click on the “Change proxy settings…” button. This should open your system network settings, where you should change the Socks Host (under Network proxy) as indicated below:

../../_images/ct-chrome-proxy.png

On Mac

In a terminal, connect to your instance using SSH with dynamic port forwarding enabled:

ssh -D 6676 tunnel@[ip]

You should leave this SSH session established while using the proxy. Now, your browser needs to be configured to use this tunnel as a proxy. The procedure varies per browser and is described below for Safari, Chrome and Firefox.

Safari

In your network settings (under system settings), change your proxy settings to use the cloud-tunnel as a SOCKS proxy, as per the example below:

../../_images/ct-safari-proxy.png

Chrome

In your browser, enter the URL chrome://settings/search#proxy and click on the “Change proxy settings…” button. This should open your system network settings, where you should change the Socks Proxy (under Proxies) as indicated on the previous Safari example.

Firefox

In your browser, change its proxy settings (under Preferences, Advanced, Network, Settings) to use the cloud-tunnel as a SOCKS proxy, as per the example below:

../../_images/ct-firefox-proxy.png

On Windows

In order to establish a SSH connection with your cloud tunnel you will need an SSH client. If you do not have one, you can download and install PuTTY from: https://the.earth.li/~sgtatham/putty/latest/w64/putty.exe

After installing PuTTY, open it and connect to your cloud tunnel instance. On the Category list, go to Connection, SSH and Tunnels. For the destination source port, enter 6676 and select Dynamic and then click on “Add”, as indicated on the image below.

../../_images/ct-putty-pf-config.png

On the Category list, go back to session and enter the IP address of your cloud tunnel instance.

../../_images/ct-putty-connect.png

You should leave this SSH session established while using the proxy.

Now, your browser needs to be configured to use this tunnel as a proxy. The procedure varies per browser and is described below for Internet Explorer, Chrome and Firefox.

Internet Explorer

On the configuration menu, open “Internet options”.

../../_images/ct-ie-proxy01.png

On the connections tab open your “LAN settings” and click on “Advanced”.

../../_images/ct-ie-proxy02.png

On the proxy settings screen, configure the socks proxy with your local host (127.0.0.1) and the port used for the SSH tunnel (6676) as indicated below:

../../_images/ct-ie-proxy03.png

Chrome

In your browser, enter the URL chrome://settings/search#proxy and click on the “Change proxy settings…” button. This should open your system internet options, where you can configure a SOCKS proxy as explained previously in the Internet Explorer example.

Firefox

In your browser, change its proxy settings (under Options, Advanced, Network, Settings) to use the cloud-tunnel as a SOCKS proxy, as per the example below:

../../_images/ct-firefox-proxy.png

Using the proxy with other clients

Many HTTP clients offer support for SOCKS proxying. Please consult the documentation for your library.

OpenStack clients

Most OpenStack command line clients use the urllib3 library. SOCKS5 support is offered via the urllib3.contrib.socks module.

cURL

CURL supports SOCKS5 proxying natively. It is available via the --proxy, --socks5 or --socks5-hostname options.