Search code examples
httpsproxymqttvpngateway

Is it possible to wrap HTTPS communication into MQTT?


again I am struggling with my lack of protocol knowledge.

Basic situation:

Device A wants to communicate with Device Z via HTTPS.

Device A is not connected to the internet but only to an internal network allowing MQTT only. Let's call this the "internal bus" B. Also connected to B is an MQTT -> HTTPS Gateway G which has internet access.

Question:

Would it be possible to wrap the complete HTTPS traffic between A and Z into MQTT payloads and use those MQTT-Packages for as well the handshaking and the data transfer - in a way that Device A and Z are not "disturbed" in their HTTPS communication?

This does not refer to somehow decrypting packages: everything should be wrapped as is into MQTT and routed forward via G - so it would be something like an OSI layer 8.

Evaluation:

My gut feeling says, that it should work somehow, but I think that to actually achieve this I would have to write my own "network driver" or "network hook" on Device A and on the Gateway G

What do you think regarding feasability?

Thanks and best regards


Solution

  • While this is possible (Nearly anything is possible if you try hard enough, people have written whole VPNs that run over DNS lookups) I would question the return on investment.

    You would need 2 topics, one for each direction of the communication and a tun/tap device on the gateway to write/read the packets to. Add in a NAT layer and it would work at the IP layer rather than at a HTTP Proxy level.