Get around that pesky firewall filtering with tsocks

I gen­er­ally don’t have any issues know­ing some­one might be snoop­ing on a bit of my traf­fic. How­ever there are times you may want your traf­fic to be a bit more pri­vate. For exam­ple if your boss is a rag­ing tyrant and your look­ing for a new job, and you know the sky would fall if he found out you emailed or hap­pened to be on Career Builder or for that mat­ter had even the slight­est idea of aban­don­ing him. Yes I am recount­ing some­thing from my past, hey at least its dis­tant past :). So if you find your­self in that sit­u­a­tion read on for how to use tsocks and ssh as a sim­ple proxy.

First things first, for this to work you need to have ssh access to a machine out­side your net­work. I like to use an account in shanghi, but really if you just ssh back to your home machine that will most likely suf­fice. Ok now that you can ssh out you can use ssh dynamic port for­ward­ing via SOCKS, but you need to install tsocks before that will be use­ful.
For debian:

aptitude install tsocks

Now you need to edit your tsocks.conf to point it to local­host (since we are using ssh dynamic ports). Ensure the fol­low­ing lines in /etc/tsocks.conf

server =
server_port = 1080
server_type = 5

So thats it! Easy eh? Now to surf or check email in pri­vacy.

ssh -D 1080 remotebox.domain.tld &
tsocks firefox &
tsocks thunderbird &

*Note: Another great use for this is when you are on the road. Many hotels block out­bound port 25, which causes you to not be able to send email with your pref­ered mail client unless you start doing ssh port for­ward­ing or some other trick­ery. And its a pita to setup mul­ti­ple out­bound smtp con­nec­tions that you have to switch to. Any­way hope you find this use­ful. Here is a video of the process for your view­ing pleasure.

[flash w=640 h=480 preview={|320|240} linktext={screencast: tsocks} mode=3 caption={screencast: tsocks}]


Leave a Reply

Your email is never shared.Required fields are marked *

To submit your comment, click the image below where it asks you to...
Clickcha - The One-Click Captcha