Using a TCP proxy to bypass firewall

In the middle of a month long holiday in Africa, I finally am at a place where I can connect my notebook to the internet. I have been able to get to my mail via webmail, but I don't have all the filters I like set up on the webmail system, so it is still way to noisy to get past all the mailing lists...

IMAP is a blessing. Except when the provider firewall blocks port 993. In this particular case it doesn't block 10993 though, so I decided to set up a proxy which would get me my mail. It was really quite simple.

So this is an example of how to use balance on freebsd 7 to set up a proxy for a TCP service. In my case i am proxying imaps via an unprivileged port on my utility server to the imaps port on the actual mail server.

I connected to my freebsd box over ublocked ssh and...

reed@host $ cd /usr/ports/net/balance
reed@host $ sudo make install

I did a quick connection test like so:

reed@host $ sudo balance -fp 10993 mail.serverbox.com:993

and a quick telnet confirmed connection to the destination so I then added some config to rc.conf:

### balance

And I am now receiving and filtering email with Mail...