Friday, July 31, 2009

Getting through firewalls with ping

The gauntlet was thrown. The lodgenet network at the riviera was blocking everything unless you pay.

Things we tried:
  • DNS tunnels
  • Listening outside on externalhost:1111
  • PingTunnel FTW!!!!
Once I verified that ICMP pings were making it all the way out and back from the public internet I started looking for a ping tunnel.

Enter PingTunnel (http://www.cs.uit.no/~daniels/PingTunnel/)

I downloaded and installed PingTunnel on my laptop and on my linode.

On the linode:
ptunnel -x [password]

On my laptop:
ptunnel -x
[password] -p -lp 8001 -da 127.0.0.1 -dp 22

This tunnels localhost:8001 to my linode:22

I finish by creating a socks proxy using ssh dynamic port forwarding:
ssh [user]@localhost -p 8001 -D 1080

Once I log into my server I configure firefox to use localhost:1080 as a socks proxy.

After these steps I'm using lodgenet internet without getting caught by the gateway.

Huzzah!

PS. If you don't think it will work, I'm posting this through the tunnel.

Update:
Connections can be problematic. You must allow all ICMP on input. The following iptables rules work for me:

iptables -F
iptables -P INPUT ACCEPT
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -p icmp -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -j DROP

The icmp rule is the one I changed that got it working.