I’m having serious challenges getting MQTT to be secure. I’m certain it’s configuration issues, or my misunderstanding of HA, but here’s where I am at.
- For router-related reasons, I can’t (yet) expose HA to the internet, so LetsEncrypt isn’t yet an option.
- I want a vanilla MQTT setup with TLS, i.e., self-signed CA, server key/cert, and then to be able to use client key/cert pairs to publish from assorted devices.
- When I put a full chain (concatenated server cert, CA cert) in, with the server key, and CA cert, attempts to connect with
openssl s_client -connect homeassistant.local:8883
still fail withverify error:num=18:self-signed certificate
errors – don’t know how to overcome that. Yes, the CA is self-signed, but it’s also explicitly set as thecafile
. - When I attempt to re-configure, and drop in my client certificate and key, I get an error “Invalid private key, ensure a PEM coded file is supplied without password” – except, the client key is supplied without a password.
- Except sometimes I manage to get past that (no idea how!) and if I do, I get “Failed to connect” messages without much guidance.
I’ve looked at a whole range of recipes, what I could really use is some simple guide as to how to get MQTT working with a custom CA, server cert, and implementing client certificate authentication.
I have done this before (successfully) with Mosquitto directly, but here, there’s no access to the plain Mosquitto config, I’m having to work through the YAMLs and I really don’t know how that gets pushed into any underlying Mosquitto setup.
If I can get this working I am happy to make it into some documentation, because right now that’s a little lightly covered.