Thursday, May 13, 2010

SSH behind University FIrewall and Proxy

Many universities (like Politecnico di Milano, polimi) leave open only port 80 and 443. I've found a not-so-simple way to connect with ssh, that usually use port 22, to a remote server. Tor does the trick.
1) Install Tor (www.torproject.org). On a mac Vidalia is a very good solution.
2) Install corkscrew (http://www.agroman.net/corkscrew/). It is a simple tool that tunnels ssh connection through http proxy. Binaries aren't available, but it's not too difficult to compile from source. After you have compiled and installed it, add this to ~/.ssh/config:

Host *
ProxyCommand corkscrew 127.0.0.1 8118 %h %p

8118 is the default port of Tor proxy. Now every ssh connection go through Tor.
3) ssh your remote server and the job is done!
PS: you can use this method to use other services that use different ports, like instant messaging, configuring as SOCK proxy 127.0.0.1:9050