Simple reverse tunnels for your PIs!

Simple reverse tunnels for your PIs!
september 19, 2015 Fredrik Sandell

The other day I was developing an application intended to be run on a set of distributed raspberry pi’s. The application setup is not trivial I and do expect a fair bit of problems once the devices are deployed. It is therefore important for me to be able to troubleshoot and collect information from the devices whenever I need to. The collection of information can probably be automated by letting them push logs to a central repository. But that does not allow me to correct issues or upgrade the software directly on the devices.

The ideal solution would be to be able to open an ssh session to each of the deployed devices at any time. It is usually not possible to address the devices directly since they will be using 3G dongles to connect to the rest of the world. Therefore I opted to set up reverse tunnels from the devices to a central node which I can address directly. After a couple of iterations of setting up reverse tunnels manually I was dismayed. It is boring and error prone.

I therefore automated the process and added the resulting implementation to github:

The ssh-hub code allows you to quickly and easily set up reverse tunnels to a large set of raspberry pi’s (or any other debian based linux system really). It manages the key generation etc. and provides setup scripts which performs all the fragile file modifications both on the server and on each attached raspberry pi.


It even provides a handy REST-to-bash interface! Which allows you to execute commands on any connected raspberry pi by executing a REST request! Needless to say you should probably take measures to thoroughly secure the REST-interface:)

0 Kommentarer

Lämna ett svar

E-postadressen publiceras inte. Obligatoriska fält är märkta *


Denna webbplats använder Akismet för att förhindra skräppost. Lär sig hur dina kommentardata behandlas.