Setting up a SOCKS server with SSH
Does your firewall block port 25 so you can’t use Thunderbird to send email? Do you have a Linux box on the open Internet? If so, you are in luck.
I run Windows on my desktop, and I have a Linode machine that runs my email server. When I discovered that I was behind a firewall that blocked port 25, I was bummed that I couldn’t send email via Thunderbird.
SOCKS to the rescue!
By setting up a SOCKS server with SSH, you can encrypt all out-bound email on your desktop, tunnel it to your Linux box, where it is decrypted and sent to its destination. Here’s how you do it:
On your Windows box, open Cygwin and run
ssh firstname.lastname@example.org -D 1234
Once the command runs, it will put you in a normal SSH console session. Just minimize the window and leave it like that.
Then, open Thunderbird and click Tools -> Options -> Connection Settings. Enter localhost for the SOCKS Host and 1234 for the Port. Tick the “SOCKS v5” radio button, and you are good to go. Now, all email that Thunderbird sends will be SSH-encrypted between your desktop and your Linux box and you can send email again despite the firewall blocking port 25.
If you get really fancy, you can install your public key in your Linux box’s .ssh/authorized_keys file and then you won’t even have to enter a password. Then, create a shortcut in Windows like this:
C:\cygwin\ssh.exe email@example.com -D 1234
And put it in the Start Menu under the Startup folder, and your SOCKS server will automagically start every time you login to Windows.
The other cool thing you can do now that you have a SOCKS server running is tunnel all your web traffic through it in Firefox. Just configure Firefox to use localhost as its SOCKS server and no one on your LAN will be able to see what you are surfing, since it will just look like encrypted SSH traffic to and from mylinuxbox.com.
Of course you’ll have to replace mylinuxbox.com with your actual Linux box’s host name.
(edited on April 23, 2007 to fix two incorrect host settings)