Sunday, February 27, 2011

SSH Tunneling to overcome Firewall rules.....

A Typical network scenario in an Organisation
So, what is SSH Tunneling ?
When one network protocol(delivery protocol) encapsulates another protocol over itself, it's called Tunneling (Wikipedia)
And when the delivery protocol is SSH its called SSH Tunneling. Simple !!

Usage Scenario
Consider a typical scenario as shown above.
We have a web server called Atlantis and a SSH server called Endeavour.
For some reason(company policy ??) users are allowed access only to SSH server and not to the webserver. What if a user wants to access the webserver ?? Without tunneling he cannot access the webserver because port 80 is blocked by the firewall rules; so what's next ?

SSH tunneling can come to rescue in such situations.
We can Tunnel HTTP protocol (web server) over SSH protocol. So, how do we do it ?
Connect to SSH server as:

$ ssh Endeavour -L8080:Atlantis:80
$ ssh [ssh server] -L[local port]:[remote machine]:[port on remote machine]


The only thing to keep in mind is that the remote machine must be accessible by your ssh server. What this does is, it opens a local port 8080 and forwards all the traffic on that port to Atlantis on port 80 through your SSH server. The SSH server acts as the relay between your machine and the webserver.

To access the webserver, just point your browser to http://localhost:8080

Other Advantages
Since SSH is a secure protocol, meaning all the communication between your machine and the server is encrypted; it helps to transfer unencrypted traffic(http) over the network through secure channel(ssh).

1 comment:

  1. Ιt's not my first time to go to see this web site, i am browsing this web site dailly and take fastidious information from here all the time.

    my web blog ... company reputation management

    ReplyDelete