views:

57

answers:

2

Hi all,

There have been a few questions like this around the place but none have really answered my question specifically.(for example http://stackoverflow.com/questions/2529941/connecting-to-device-behind-firewall )

What I want is a central server, that receives a heartbeat from multiple ( say 100's) embedded devices behind personal firewalls. These devices need to be able to do two things.

  1. Grab new config from the server. I suspect I can just do this via a http get from the device to the server and pull down some XML, then reload its own config.
  2. Open an ssh connection to the server to allow an admin to login to the command line of the device and do maintenance and troubleshooting remotely.ie device => server <= admin and admin can get to bash command line or equivalent.

the device is a low powered embedded device that will be running linux. A solution in python would be preferable (im thinking something with paramiko for the ssh) but im open to other solutions. The main thing is there is there will be no technical users in the private network, so it should be able to plug into a consumer grade ADSL modem, get a DHCP address and all this should work. I can preload the device with anything before hand, for example ssh certificates for passwordless ssh etc.

anybody got any idea's?

Cheers

Mark

+2  A: 

You can setup ssh tunnel (from python script or from console):

ssh -NR10022:localhost:22 [email protected]

Then you can simply login to main server and then ssh bar@localhost -p 10022

You should have ssh keys, so you don't have to put password (google about "ssh without password").

Tomasz Wysocki
It seems unfortunate to tunnel ssh over ssh.
sarnold
@sarnold, I presume that this is actually more like plugging in one ssh connection to another? this is not the case?
Mark Underwood
@sarnold: any better ideas?@Mark Underwood. Whats exactly happens is that this command creates ssh tunnel from 10022 port on server to 22 port on embedded device. So if you send data to 10022 it will be transfered throw ssh to embedded device. sarnold in fact is right. If you create ssh connection on 10022 it will live in ssh tunnel (another ssh connection). But theres nothing wrong with that. In fact it will be hard to figure out better solution.
Tomasz Wysocki
are you suggesting that every device leave the ssh tunnel open 24/7?
Casey
@Tomasz ok, thanks for the clarification. I think I understand it better. the incoming connection from the admin just gets forwarded through the ssh tunnel on port 10022 of the server to port 22 of the embedded device. I figure this is an ok trade off. Do you know if you can do this with paramiko?
Mark Underwood
A: 

A more elaborate method might be some type of firewall hole punching.

On second though, maybe this is not necessary, since there is only one firewall involved. The trick is to get your embedded device to initiate an outbound connection first.

Casey
I think I have a solution for the openning the outbound connection. Because of the device polling for new config data as described in point 1) we should be able to trigger it to open a ssh port.
Mark Underwood