SSH Tunneling

Your Dreamhost account can be used to create a secure tunnel to circumvent firewalls that prevent access to particular websites. This isn't recommended as a replacement for a VPN or similar service, but if you need the occasional ability to reach sites that would otherwise be unreachable *or* need secure access because you are using an unsecured access point, this might be an appropriate solution for you.

SOCKS is the name of the protocol used. SSH is the name of the software used to create the tunnel. There are a number of GUI options available for Windows, Mac OS X, and *nix, but using SSH usually demands a command-line environment. This article will assume that it is installed and configured appropriately. Practically speaking, this information is not that important. You just need to know the magic incantations.

Note: This is a great temporary solution if you need to view something your ISP has blocked for unknown reasons. It should be considered a temporary solution, as it will definitely use bandwidth on your account. When you are on a shared server, it's nice not to abuse the system.

=Easy-Option Windows Instructions=

1. Lightweight

Download Plink

Open a command-line window, navigate to the folder containing plink.exe and type:
 * plink -ssh -2 -D 9999 username@servername.dreamhost.com
 * Enter your password


 * You can put this easily in a batch-file for a quick start.

Open Firefox:
 * Firefox -> Options -> Advanced -> Network tab
 * Settings -> Manual proxy configuration
 * SOCKS Host: 127.0.0.1 or localhost
 * Port: 9999

Done

2. Using multiple tools

Instructions based on this forum thread.


 * You need:
 * Bitvise Tunnelier
 * FoxyProxy for Firefox
 * A Dreamhost hosting account


 * 1) Log into your dreamhost account and make sure you have a user set up for shell access.
 * 2) Install Tunnelier.
 * 3) In the 'login' tab use these settings
 * 4) Host: your host - i.e. blink.dreamhost.com or my.host.com,
 * 5) Port: 22
 * 6) Username: your user name
 * 7) Initial Method: Password
 * 8) Password: your password
 * 9) Check: Store encrypted password in profile.
 * 10) Under the services tab, set up the proxy option as follows:
 * 11) In the SOCKS/HTTP Proxy Forwarding area:
 * 12) Check 'Enabled'
 * 13) Listen Interface: 127.0.0.1
 * 14) Listen Port: 1080
 * 15) (Leave the rest alone)
 * 16) Save and name the profile to a folder 'Tunnelier Profiles' perhaps in 'My Documents'.
 * 17) Install FoxyProxy in firefox and set up a new proxy as follows.
 * 18) Under proxy details tab check 'Manual configuration'.
 * 19) Host or IP Address: 127.0.0.1
 * 20) Port: 1080
 * 21) Check: SOCKS Proxy
 * 22) Select: SOCKS v5
 * 23) Launch the profile from the desktop and then select the proxy in firefox with FoxyProxy.
 * 24) Remember to disable FoxyProxy and exit out of Tunnelier when you're finished.

=Mac Instructions= These instructions are for the Mac (or any *nix environment). Windows users can do this via PuTTY.

= Setting Up Your Tunnel= 1. Open Terminal

The default location for this is in /Applications/Utilities/ but if you can't find it, you can use Spotlight to look for it (look in the blue search bar in the upper right hand corner).

2. Execute the ssh command

Upon opening Terminal, you should see a prompt that looks something like this:
 * Avericity:~ avery$

Type in the following:
 * ssh -D 9999 username@hostname.com

There are several options that you could run along with -D. -D just indicates that we are creating a dynamic port; the subsequent number indicates what port we actually created. Other options that are interesting are:
 * -C: for compression
 * -N: to create a non-interactive shell
 * -vv: to see all the network connections created

So your ssh command could looks as complicated as:
 * ssh -vv -CND 9999 username@hostname.com</tt>

=Directing Your Browser=

Firefox
In Firefox you can go to your preferences, and under the Advanced settings there is a Network tab. Click on the button labeled: Settings... There, you want to select Manual proxy configuration and under SOCKS Host enter 127.0.0.1 or localhost. For the port, enter 9999 or whatever port that you chose. This should work. I haven't gotten it to work; I use Safari instead.

Safari
Using Safari requires you to modify your Network preferences. In the Network preference pane, click the Advanced... button at the bottom of the pane. Now click the tab labeled Proxies. There will be a pull-down menu, select Configure Proxies: Manually. Under protocols to configure, make sure the SOCKS protocol is checked. Make sure that your SOCKS Proxy is set to 127.0.0.1 and the port number is set to 9999.

Verify your tunnel
To check if you are browsing via dreamhost, have a look at e.g. http://www.hashemian.com/whoami/

=Caveats=
 * Everything seems to work except for connecting to Twitter. When I try to connect to twitter, all my other connections hang and it hangs as well.

=External Links=
 * Accessing Facebook throught the Great Firewall
 * Bypass Websense, surf and chat anonymously with SSH Tunneling