Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mosquitto_sub with TLS enabled

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 link to image
  • 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.

like image 684
cam Avatar asked Dec 04 '22 22:12

cam


1 Answers

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

like image 67
Khush Bhatia Avatar answered Dec 11 '22 10:12

Khush Bhatia