SSH out of device

Hi,

I’m trying to create an device (RPI3), that we would send out along with som network products.

We will then run a script, that checks that all devices are online. If one of them are failing, we would like to be able to SSH out of the device, from the Balena dashboard.

For now, I have only tested with a clean image and then I run the SSH command, but I keep getting: “…no matching key exchange method found. Their offer…” error, when trying to connect to the switch.

Do I need to install something to make SSH work outgoing from the device?

You’ve not included the key piece of information of what algorithms the other end was offering for key exchange, but my guess is the devices you’re trying to SSH to probably don’t support any of the key types supported by the version of SSH shipping with balenaOS.

There’s a couple of options:

  1. Ship your Balena devices with an SSH container in which you’ve installed a version of SSH which is compatible with the switches you’re trying to connect to.
  2. Don’t SSH from the Balena device at all, and instead just use that device to provide you with a tunnel you can SSH through:
$ balena tunnel $DEVICE_UUID 22222:22222 # tunnel the device's SSH port to localhost
# In another shell
$ ssh -L ${SWITCH_IP}:22:localhost:222 -p 22222 ${BALENA_USERNAME}@localhost 
# In yet another shell
$ ssh -p 222 ${SWITCH_USERNAME}@localhost

The second ssh there will SSH to the Balena device, and then use that connection to tunnel any traffic received on localhost:222 to ${SWITCH_IP}:22, which means if you then SSH to localhost:222 you’re actually going to pop out on the switch you were trying to connect to.