I’ve just been working in a cafe whose wifi blocks outgoing email. So I had to figure out how to send mail through an ssh tunnel. That is, hussle it through the firewall by sending it encrypted to a server elsewhere, and send the email outgoing from there.
For future reference, and in case it’s useful to anybody else, here’s how. This is assuming you are running ubuntu on your own machine, and have ssh access to a server somewhere else that’s capable of sending mail.
We use ssh to set up a SOCKS proxy, over an ssh tunnel. This establishes a port on the local machine (here, port 1234). any traffic sent through that port will emerge from the server at the other end:
ssh -D 1234 username@server.net
Now, install tsocks. This lets you run another program, with all outgoing connections sent via SOCKS
sudo apt-get install tsocks
configure tsocks to use the tunnel you’ve set up
sudo vim /etc/tsocks.conf
look for the default server settings, at the bottom. Edit so that:
server = 127.0.0.1
server_port = 1234
Now start your mail program under tsocks
tsocks evolution
In order to make external mail sending work under this setup, I had to turn off TLS in evolution. I’m not sure if this is a problem inherent to the socks/ssh setup, or just with my particular situation.
more info: http://ubuntuforums.org/showthread.php?t=791323