Proxy for SSH
Sometimes I need to ssh to my servers back at school when working in the company; Since the corporate proxy servers support HTTPS and don't block connections to port 22, ssh over proxy is possible, and here is what I did to make it work:
- Install connect-proxy: The debian package description is pretty clear in describing its functions:
1
apt-get install connect-proxy
1
Description: Establish TCP connection using SOCKS4/5 and HTTP tunnelconnect-proxy is a simple relaying command to make TCP network connectionvia SOCKS or https proxies.It is mainly intended to be used as proxy command of OpenSSH.
- Edit ~/.ssh/config and add the following lines (modify to suit your needs):
1
2
3
4
5
6
7
8
9# not using proxy on lan
Host 172.16.*
ProxyCommand connect-proxy %h %p
Host localhost
ProxyCommand connect-proxy %h %p
# mandatory to access the internet
Host *
ProxyCommand connect-proxy -H proxyserver:proxyport %h %p
Now when you run ssh to connect to servers not on your LAN, connect-proxy is used along transparently.