News for hackers. Stuff that matters.
Re:Secure your MQTT server with authentication and encryption by fullstop on Monday February 01, 2021 @09:02AM (#25988734)
I found it to be much easier to put haproxy in TCP mode in front of mosquitto than to use mosquitto's TLS capabilities. This lets me reload the certificate without restarting mosquitto.

My local devices (esp8266) can't really handle TLS well, but I want access from outside of my local network to be encrypted. This lets them operate in plain-text mode locally, with firewall rules forcing outside access to be secure.

Re:Secure your MQTT server with authentication and encryption by juriansluiman on Monday February 01, 2021 @09:09AM (#25988803)
Author here:

That's exactly what this post does only with Traefik instead of haproxy. The TLS of Mosquitto is just too much of a maintenance burden.

A cross post from what I replied at a Reddit topic:

> Mosquitto does have TLS support by itself, but the manual only deals with self-signed certificates. Self-signed certificates do involve a maintenance burden I don't want to deal with. All my applications/devices which expose a HTTP frontend (or other TCP stream) are encrypted via Let's Enncrypt certificates. They are automatically trusted by a lot of platforms (pc's, phones and other devices).

> I was using acme.sh before and the post-install hook can refresh every service, but it just wasn't working properly on every occasion. You also have to reload all your applications for loading the new certs (that is, Home Assistant, Unifi, Pi-hole, mosquitto, my smart meter readings platform and so on). Just reloading everything for a cert renew felt cumbersome, and Traefik dealing with TLS termination decouples the TLS part from the application itself.

> Since I used Traefik already, it was really straightforward to put Mosquitto behind Traefik too. Of course every situation is different, this post is mainly geared towards users which do not authenticate or encrypt Mosquitto at all.

Re:Secure your MQTT server with authentication and encryption by fullstop on Monday February 01, 2021 @09:16AM (#25988863)
I'll have to give Traefik a peek. I've used haproxy for a long time, and it's my go-to tool for my TLS termination and proxy needs, but it's always good to have more tools.
Re:Secure your MQTT server with authentication and encryption by RedShift1 on Monday February 01, 2021 @11:47AM (#25990317)
Mosquitto 2 supports reloading the TLS cert without restarting. Send SIGHUP to reload certs.
Re:Secure your MQTT server with authentication and encryption by fullstop on Monday February 01, 2021 @12:44PM (#25991022)
This is also good to know. Thanks, I was unaware that 2.0.x had been released!
Re:Secure your MQTT server with authentication and encryption by eeZah7Ux on Monday February 01, 2021 @09:51AM (#25989131)
You are much better off with a gateway than a proxy.
Re:Secure your MQTT server with authentication and encryption by fullstop on Monday February 01, 2021 @10:02AM (#25989217)
Can you explain further?
Re:Secure your MQTT server with authentication and encryption by eeZah7Ux on Monday February 01, 2021 @07:05PM (#25995870)
Very often in home and industrial automation you want to have a smart enough, local, gateway that can:

- speak multiple protocols as needed by the devices

- aggregate data, provide history of values from sensors & so on

- isolates the (limited) network stacks of local devices from the Internet - e.g. provides different timeouts and retransmission behavior

- terminates a VPN, often providing better security than exposing services directly on the Internet!