mosquitto_sub with TLS enabled

mosquitto, mqtt, tls1.2

Solution

In the mosquitto_sub command, use the --capath argument to point to /etc/ssl/certs. It needs a pointer to the trusted certificates.

Problem

I am new to MQTT and I have a frustrating problem. I have been using MQTT.fx to subscribe to a topic; I have set the: - Broker Address - Port - Client ID - Enable SSL/TLS - Topic This works well, however I would like to use mosquitto_sub. I am attempting to subscribe to the same topic in the following way: ``` mosquitto_sub -h host -p 8883 -t topic -i client id ``` This is not working for me. I am using it on a Ubuntu VM. My powers of observation tell me that I should enable TLS, however I'm not quite sure how to do that, I have stuffed around with certificates and enabling TLS in may ways but have not got the right combo. I know it is required as if I uncheck the SSL/TLS box in MQTT.fx I am unable to connect. I would really like to replicate what I have in MQTT.fx with mosquitto.

Original source