Hi HA community.
I’ve spent days attempting to sent a MQTT update between two RPis, one with a hass.io instance using the MQTT broker addon (installed by supervisor), the other from a blank RPi install using “mosquitto-clients”.
I’ve successfully managed to do this on an insecure port, however I’m having issues using TSL/SSL.
I’ve generated the server certificates following this guide
I’ve generated the client certificates following this guide
I have followed @duceduc post regarding creating a v3.ext file to include DNS & IP.
I’ve successfully sent encrypted updates internal to my home network
The issue is with external communication via the internet.
I can successfully send an update if I include “–insecure” in the publish command. However without it the following error is received.
Client mosqpub|920-raspberrypi sending CONNECT
Error: host name verification failed.
OpenSSL Error: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed
Error: A TLS error occurred.
It seems there’s an issue with the host name. What host name should be used in the Common name when generating the certs? I’ve tried “hassio” (from the system tab under supervisor)… I’ve tried the hostname on the mosquito broker page “core-mosquito”. I’ve tried the local IP as well.
Additional information.
Example command - internal to network - no issue
mosquitto_pub --cafile ca.crt --cert client.crt --key client.key -h 192.168.0.50 -p 8883 -u mqtt -P password -t "topic" -m "1234" -d
Example command - External to network with “–insecure” - no issue
mosquitto_pub --cafile ca.crt --cert client.crt --key client.key -h <xxxxx>.duckdns.org -p 8883 -u mqtt -P password -t "topic" -m "1234" --insecure
Example command - External to network - fail
mosquitto_pub --cafile ca.crt --cert client.crt --key client.key -h <xxxxx>.duckdns.org -p 8883 -u mqtt -P password -t "topic" -m "1234"
Note:
I’m using lets Encrypt and Duckdns, so the host is pointing at .duckdns for hostname resolution.
Any guidance or suggestions on the common name would be appreciated.