Terry : SSH Through HTTP Proxy

SSH via HTTP Proxy

Company network like Oracle requires HTTP Proxy to access the Internet, the ssh command won't work unless you do some tricks.connect-proxy

connect-proxy
Establish TCP connection using SOCKS4/5 or HTTP tunnel. connect-proxy is a simple relaying command to make tunnel TCP connection via SOCKS or HTTPS proxies.
It is mainly intended to be used as proxy command of OpenSSH.

connect-proxy command Usage

USAGE
       To  use  proxy,  this  example  is  for SOCKS5 connection to connect to
       "host" at port 25 via SOCKS5 server on "firewall" host.

       connect-proxy -S firewall host 25

       SOCKS5_SERVER=firewall; export SOCKS5_SERVER; connect-proxy -s host 25

       For a HTTP-PROXY connection:

       connect-proxy -H proxy-server:8080  host 25

       HTTP_PROXY=proxy-server:8080; export HTTP_PROXY; connect-proxy -h  host
       25

       To forward a local port, for example to use ssh:

       connect-proxy -p 5550 -H proxy-server:8080 host 22 ssh -l user

       To use it along ssh transparently:

       # file://~/.ssh/config
       # not using proxy on lan
       Host 192.*
       ProxyCommand connect-proxy %h %p
       # mandatory to access the internet
       Host *
       ProxyCommand connect-proxy -H proxyserver:8080  %h %p

       Or for all users ( /etc/ssh/ssh_config )

Install connect-proxy (Debian and Ubuntu)

sudo apt-get install connect-proxy

Edit ~/.ssh/config file

The example works like a White list (for tux.im only).

## Outside of the firewall, with HTTPS proxy
## Package connect-proxy is required.

# VPS
Host tux.im
  ProxyCommand connect -H www-proxy.au.oracle.com:80  %h %p
  ServerAliveInterval 20

# Amazon EC2
Host *.compute.amazonaws.com
  ProxyCommand connect -H www-proxy.au.oracle.com:80 %h %p
  ServerAliveInterval 30

# cloud.terry.im
Host cloud.terry.im
  ProxyCommand connect -H www-proxy.au.oracle.com:80 %h %p
  ServerAliveInterval 30

## Inside the firewall (do not use proxy)
Host *
   ProxyCommand connect %h %p

NOTE: other tools that can do the same corkscrew, socat.