Friday, February 6, 2009

Surf FREE! - Tunnel HTTP through SSH

Wanting to break free from surfing rules is always an interesting topic. Just how could you evade the prying eyes of the firewalls , the site name checkers placed in the DNS and the administrator's doting eyes.


Here I provide an infamous way of surfing free!. Some smart work is required which is a trait common to all sorts of "nerdy" mischief!


The method is common to POSIX(Read Linux) and Windows systems. I evangelise Microsoft at Office. At home i luv tinkering around with Linux. OK! Lots of TP talk . Lets get down to the core.


Software you would need :-


1) Putty - a SSH client


Alternatives :- any SSH client software would do. I suggest Putty for it is easy to use, and small to download too.



2) OpenSSH - a SSH server software.


Alternatives :- again any SSH server would do


3) Firefox

I do not support IE in this because i could not get this method to work with IE. You could try and tell me if it worked for your case.




Now this is what you need to do. Follow the steps as if they were etched in gold and u will attain nirvana!

1. Install OpenSSH on the machine u have net and u want to tunnel through into. This would ideally be a machine out side your firewall policies but to which you can ping into.

2. U must consider that OpenSSH inherits the usernames and the password windows already has on the local machine. Try and get preferably an admin account on this machine. Its easyy to say this..but this is the toughest part of the job-To break into this machine to get an admin account.
I will put in another post on how to successfully get an admin account on the windows machine if you are not a authorized administrator. In fact chances are you might now be allowed to install OpenSSH too if u are not the admin. More on this in a later post.

3. Now you need to set up SSH i.e. add users from the windows machine into OpenSSh so that somebody can remote logon.
Fire up the command promp and type in the following

mkpasswd -l -u username >> ..\etc\passwd
Substitute -l with -d to add a domain user info into the passwd file of SSH.
Eg.
mkpasswd -l -u jack >> ..\etc\passwd

You could add a group with the mkgroup command
mkgroup -l >> ..\etc\group

Once this is done you are done with setting up OpenSSH.

now fire in this command
c:\> net start opensshd
This starts off the service and it now waits for incoming connections via port 22. You could change the port configuration by changing the sshd config file.

Now come back to the PC which is behind shackles(read firewall)
Run putty.

Set up a session as shown in the pics below
But before you set up the session you must configure putty for dynamic port forwarding.

Drill down into the connection tab on the left list of items and go into SSH -> Tunnels. Enter the port number you want to forward. Be sure that this outgoing port is not blocked on your system.

Mark the dynamic selection and now go back to the putty main page and enter the IP address of the OpenSSH machine and select SSH as the mode of remote login.

Save this session for future use. Give it a name. Now click on open.
Enter the credentials as required. When connecting for the first time you will be asked for a RSA fingerprint verification. Just click yes. You may not worry. You may not read. For digging deep into it you may look out for information on SSH authentication.


Cool now ! If you see a command prompt, you have been able to log into the machine! Give yourself a pat on the back. If not put down your problem below and i will be happy to help you out.

But there is little more to be done before you can surf free.

Bring up Firefox. You need to be making a few connection setting changes.
You need to configure the proxy settings and allow remote DNS resolving. Things should start working thereafter.

First the connection setings change to enable connection through the SOCKS proxy you just set up!
Click on the setting tab after you have reached to the settings window of Firefox above from Tools->Options.

Now to plug in the settings.

Select SOCKS v5 and put in the same port number you put into the putty config.

Next click on OK and firefox is almost set. Just on last thing and this is the golden tip that will set u free

write about:config into the firefox URL box and press enter. Halloa! a hidden firefox config page comes up.
Scroll down to network.proxy_socks_remote_dns setting and set it to true.
DONE!

Restart the Firefox browser and surf in glory.
Do post in you queries. Will be happy to resolve. Till then adieu.