SSH Proxy Connect

Configuration

This ssh proxy connect utilty documentation explains how to connect with your ssh client to a ssh server, located on the internet from a local network protected by a firewall or NAT through a proxy(HTTPS for example). Then show you how to configure your ssh client to use the proxy when ssh client tries to connect to your ssh server.

Requirement are :

  • Your firewall has to allow HTTPS connections through a proxy
  • You need to have root access to the server where ssh is listening
  1. Install the connect software :
  1. Configure your ssh client.
  • Open or create your ~/.ssh/config file and add these lines :

    Outside of the firewall, with HTTPS proxy

    Host my-ssh-server-host.net ProxyCommand connect -H proxy.free.fr:3128 %h 443

    Inside the firewall (do not use proxy)

    Host * ProxyCommand connect %h %p

  1. Configure the ssh server.
  • Edit this file (on debian system) /etc/ssh/sshd_config and add this line :

    Port 443

    Then restart the daemon :

    sudo /etc/init.d/ssh restart

Then pray and test the connection :

$ ssh my-ssh-server-host.net

SSH to another server through the tunnel

For example to connect to in ssh github.com :

Host github.com ProxyCommand=ssh my-ssh-server-host.net "/bin/nc -w1 %h %p"

Reference

  1. [SSH through HTTP proxy] zeitoun.net
  2. [Bypass Any Firewall] SaulChristie
  3. [ProxyTunnel: punching holes in HTTP(S) proxy] proxytunnel
  4. [OpenSSH proxy command for socket connection using SOCKS4/5 or HTTP tunnel] gotoh