If you are unable to establish a VPN connection for what ever reason be it software
restrictions, blocked ports etc, you could always try an SSH tunnel. This method of bypassing the corporate or university firewall is not as useful, the reason for this is because you require the ability to change the proxy settings in each application which should connect via your tunnel. Where as a VPN connection will redirect your default gateway meaning ALL traffic including DNS etc will be protected. SSH tunnels can be victim to DNS leaks.
DNS Leaks
DNS leaks occur when a DNS look up is requested this is then queried against your corporate or university DNS server, which potentially means your network administrator can still see what you are intending to look at.
Update:
A reader pointed out that it is possible to fix this issue by typing about:config in to the address bar and to search for dns. Find the entry that is related to remote socks dns and change its value to dns. This should solve the DNS leak.
Why SSH tunnels often work via port 443
SSH tunnels are usually very successful and the reason for this is because most, not all but most corporate and university proxies do not inspect HTTPS traffic. Instead when a HTTPS connection is requested the proxy allows a CONNECT on port 443 to the destination HTTPS server in theory providing a direct connection. Now to get this to work you are going to need your SSH server listening on port 443, you can specify multiple ports for sshd to listen on.
The location of the sshd_config on CentOS is “/etc/ssh/sshd_config”, you will need to open this file in your favourite text editor such as “Nano” and find the line which looks like this “#Port 22″. Uncomment the line so it looks like “Port 22″ then directly below on the next line put “Port 443″ you must bear in mind that your server must NOT have anything else listening on port 443 for this to work. Once you are happy you have done this correctly save the file and then issue the command “service sshd restart” or on Debian this would be “/etc/init.d/sshd restart”. Your SSH server should now be listening on both Port 22 and Port 443.
Configuring Putty
Now open Putty and click on the “Proxy” category on the left. Now fill in your proxy details. Replace “corporate proxy host name or ip address” with the IP address or hostname of your corporate or university proxy server, now do the same with the port number. Usually the port number will be 8080 or 3128 but where I work it is 8090 (I have no idea why).
Now select the “Session” category on the left, again you will need to replace some examples here with your own settings starting with “ssh server host name or ip address” replace this with the IP address or hostname of your SSH box. The same with the port number you need to set this to “443″. Under “Saved Sessions” enter a descriptive name in the text box such as our example “ssh proxy connection” and then click save.
Ok now for the last setting within Putty, you need to enable a dynamic port forward to allow proxied traffic to pass through the SSH tunnel. On the Category list on the left under “Connection” click “SSH” and this shall expand another menu with options such as “Kex, Auth, TTY, X11, Tunnels, Bugs”. Click on “Tunnels” and then replicate the settings below. Ensure the “Source port” is set, in this example we have used port 5000 but you can use anything that is not already in use, I would suggest staying with 5000 just to make things easier though.
Now click the “Add” button and the setting should be applied and added to the “Forwarded ports:” list just like the example below. Notice the “D5000″ in the “Forwarded ports:” list? This basically means there will be a socks proxy listening on port 5000.
We dont want to have to enter these settings every single time we want to connect to our tunnel server so go back to the “Session” category and click the save button. Your session will now be saved and appear in the “Saved Sessions” list below “Default Settings”
Double click on your saved session within putty and a black window will pop up asking for you to enter a username, once you have entered this press the “Return” key and you will be prompted for a password. The same with the password enter this and press the return key, now if you entered a valid login for an SSH enabled account on your server you will be shown a system shell.
In theory if you see the shell your tunnel should be established and you should be able to set the proxy settings within your applications to connect via the tunnel. An example for Firefox is below.
Click ok and then within Firefox browse to “http://www.whatismyip.com” and this should now show the IP address of your SSH server! Congratulations you have now made a tunnel straight through your corporate or university firewall.
That’s it! Having trouble?
If you couldn’t get this to work just leave a comment and I will try to help you out. Remember though as always trying anything like this could be a severe breach of your networks acceptable use policy!





























