# Difficulties with running Mosquitto with TLS

**URL:** <https://forum.cedalo.com/t/difficulties-with-running-mosquitto-with-tls/821>\
**Category:** Security\
**Created:** [June 21, 2023, 7:17am UTC](https://forum.cedalo.com/t/difficulties-with-running-mosquitto-with-tls/821 "2023-06-21T07:17:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![khaosgott](https://avatars.discourse-cdn.com/v4/letter/k/cc9497/32.png) [@khaosgott](https://forum.cedalo.com/u/khaosgott)\
**Post date:** [June 21, 2023, 7:17am UTC](https://forum.cedalo.com/t/difficulties-with-running-mosquitto-with-tls/821/1 "2023-06-21T07:17:28Z")

</div>

Hello,  
I hope all is well, and would like a suggestion how to set up the TLS on the local Broker.

This is a standalone VM server running Centos 8 and Mosquitto 1.6.15, installed using DNF package manager.

from **mosquito.conf** :

allow\_zero\_length\_clientid false  
port 8883  
capath /etc/mosquitto/tls  
certfile /etc/mosquitto/tls/server.crt  
keyfile /etc/mosquitto/tls/server.key  
log\_dest file /var/log/mosquitto/mosquitto.log  
log\_type error  
log\_type warning  
log\_timestamp true  
log\_timestamp\_format %Y-%m-%dT%H:%M:%S  
allow\_anonymous false

After the initial setup, the service is up and running, and is listening on port 8883.

● mosquitto.service - Mosquitto MQTT Broker  
Loaded: loaded (/usr/lib/systemd/system/mosquitto.service; enabled; vendor preset: disabled)  
Active: active (running) since Wed 2023-06-21 07:04:41 UTC; 5s ago  
Docs: man:mosquitto.conf(5)  
man:mosquitto(8)  
Process: 32755 ExecStartPre=/bin/chown mosquitto: /var/log/mosquitto (code=exited, status=0/SUCCESS)  
Process: 32752 ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto (code=exited, status=0/SUCCESS)  
Main PID: 32757 (mosquitto)  
Tasks: 1 (limit: 204292)  
Memory: 1.1M  
CGroup: /system.slice/mosquitto.service  
└─32757 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf

Jun 21 07:04:41 mqtt\_server systemd[1]: Starting Mosquitto MQTT Broker…  
Jun 21 07:04:41 mqtt\_server systemd[1]: Started Mosquitto MQTT Broker.

However when Im trying to run a test pub message, I face an error message.

**Pub request:**  
mosquitto\_pub -h 127.0.0.1 -p 8883 -t TestTopic --cafile /etc/mosquitto/tls/ca.crt -m TestMessage

**Error message:**  
OpenSSL Error[0]: error:14094418:SSL routines:ssl3\_read\_bytes:tlsv1 alert unknown ca

I’ve used an additional CA server (Microsoft Server) to generate new CA for Mosquitto, the error however remains the same.

I would really appreciate any suggestion or advice.

Thank you in advance
