netcat jabber and openvpn fun

general = { about, articles, links, projects }     meta = { date-posted: 2006-09-27 }

Today I was behind a firewall that wouldn't let me pass jabber traffic through it. Bummer.

Luckily, I have openvpn. I created a tunnel to my home network. I wanted to use jabber, so I simply created a route for my jabber server, through the tunnel. It worked fine.

The only problem is.. I didn't really want all traffic to that IP to go through my home network..just the jabber traffic. What to do? Use netcat of course!

So, I removed the host route, and executed the following commands on an internal system in my home network (logged in through the openvpn tunnel over ssh).

 $ mknod backpipe p
 $ nc -l -p 5222 0<backpipe | tee -a inflow | nc cactuswax.net 5222 | tee -a outflow 1>backpipe

The tee sections were just for curiosity. It dumped the jabber xml out into files, so I could see what was flying by. A more streamlined version looks like this...

 $ mknod backpipe p
 $ nc -l -p 5222 0<backpipe | nc myjabberserver.example.com 5222 1>backpipe

I then simply had to change the server I was trying to connect to, to the machine on the inside of my home network. The jabber traffic went through the openvpn tunnel, was basically tcp proxied by netcat, then out to the jabber server it went.

yay.