Tuesday, July 5, 2011

fun with ssh



for the 4th of july weekend we headed to los cabos, mexico for a family reunion. we stay at this really nice resort, barcelo, and they have these really cool plasmas on the wall. we start playing with them: they have games and a web browser and come with a keyboard. you can facebook on it! pretty cool.

i notice that it's running google chrome and then my son finds gnu chess. definitely running linux, so 30 seconds after turning on the tv we have a shell. (you just have to push alt-f2 and startup bash :)


now, what can you do with a shell? more specifically, since we don't want to mess up anything or use exploits, what can you do from user space?

well we don't actually know the guest (huesped in spanish) password, so we are further limited. but there are a couple of things i noticed:
  1. the wifi network, which you have to pay $20 a day for, is accessible from the network (ethernet) that the room is hooked up to. the wifi network is one of those that give you an ip address, but doesn't route you to the internet until you pay.
  2. there is some sketchy proxying going on. i'm sure they aren't doing anything malicious, but i'm a bit paranoid about these things.
  3. it has ssh.
  4. we brought our wifi router from home. (ok, i kind of knew that before we walked into the room :)
one other thing to consider is that we have a bunch of wifi devices: 3 itouches, 2 computers, and 2 phones. so, i do the project i've been wanting to do for a long time! transparent socks proxying at the network layer. because there are other devices involved i'm throwing in ip masquerading on top.

if i wasn't worried about observation number 2, i could have just started up a simple socks proxy on the tv. instead i use a remote vps (basically a web service shell acount)  i have from jaguarpc.

getting internet access


before i start, let me just point out this was a research project. i actually got legitimate wifi access after i got this working. you should too. $20 is kind of a rip off, but not a total one. (it does seem to go against the notion of an "all inclusive" resort though...)

first, setup my laptop to connect to the wifi network. whenever i try to connect anywhere i get the prompt for the login or payment for internet service. we'll fix that in just a second.

the easiest option to get internet access would be to ssh from the tv to my external ssh account using:
ssh -g -D 1080 myserver.me
but that would open up access through my server to everyone. of course, i'm just being paranoid since why would anyone look for an open socks proxy on the tv in our room?

since I am paranoid i do something better:
ssd -R 2222:myserver.me:22 laptop-address
the laptop-address is the address of the wifi interface of my laptop. once i ssh into my laptop, i can now use
ssh -D 1080 -p 2222 myserver.me
to connect myserver.me from my laptop. since i'm using the -D option, i also have a fully functional local socks proxy going. so, i change the proxy of my web browser of my laptop to 127.0.0.1:1080 and voila (or andale since we are in mexico) i'm on the internet from my laptop.

ok, so this is a start. it's such a pain to setup socks settings, and i want to allow the rest of my devices to connect through, so of course i didn't stop there.

No comments:

Post a Comment