Some weeks ago, someone asked at the #HiveMQ Slack channel if there is any way to run SSH over MQTT…
👉 Strange idea? I liked it, and I want to share the TCP-MQTT-TCP bridge I made weeks ago.
🤔 Use Case? Imagine you have IoT’s connected to a central MQTT broker and you want to connect from one to another via SSH, transfer files, expose services, a Webpage, without exposing ports to the public internet or creating a VPN.
⚠️ Be careful and please evaluate and consider the possible security impacts before using this “backdoor man” … the doors …
⚠️ And transferring files over MQTT may increase your cloud bill 🤑
👉It’s on GitHub, it is just a draft and can be used as a template to be extended by your needs.
👀 How to? Start the client.js script at the destination host – or more precisely at a node in the local network where the destination node runs – and start the server.js script on the source node from where you want to connect to the remote/destination host and port. For example, if there is a SSH server running on the destination host+port, then you can do a SSH localhost -p 8080 -l username at your source node, and you will get a SSH connection from the source node to the destination node. And the data is transmitted over MQTT topics.
![](https://www.rocworks.at/wordpress/wp-content/uploads/2024/02/overview.png)