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
balance_enable="YES"
balance_hosts="host1"
balance_host1_address="my.proxy.box.com"
balance_host1_ports="10993"
balance_host1_targets="mail.server.box.com:imaps"
And I am now receiving and filtering email with Mail...
Cake