I am new to mosquitto. I've been trying to configure SSL/TLS for mosquitto recently. I followed the tutorial online but the final result is as follows
D:\mosquitto>mosquitto -v -c mosquitto.conf
1663013203: mosquitto version 2.0.15 starting
1663013203: Config loaded from mosquitto.conf.
1663013203: Opening ipv6 listen socket on port 8883.
1663013203: Opening ipv4 listen socket on port 8883.
1663013203: Error: Unable to load CA certificates. Check cafile
"d:\mosquitto\certs\ca.crt".
1663013203: Error: Unable to load server certificate "d:\mosquitto\certs\server.crt".
Check certfile.
1663013203: OpenSSL Error[0]: error:02001002:system library:fopen:No such file or
directory
1663013203: OpenSSL Error[1]: error:20074002:BIO routines:file_ctrl:system lib
1663013203: OpenSSL Error[2]: error:140DC002:SSL
routines:use_certificate_chain_file:system lib
I put ca.crt, server.crt and server.key in the certs subfolder of the mosquitto folder.And the configuration in mosquitto.conf is as follows:
listener 8883
allow_anonymous true
cafile d:\mosquitto\certs\ca.crt
certfile d:\mosquitto\certs\server.crt
keyfile d:\mosquitto\certs\server.key
require_certificate false
tls_version tlsv1.1
# Config file for mosquitto
#
# See mosquitto.conf(5) for more information.
#....
And The code used to generate the key and certificate is as follows:
#openssl req -new -x509 -days 3000 -extensions v3_ca -keyout ca.key -out ca.crt
#openssl genrsa -out server.key 2048
#openssl req -out server.csr -key server.key -new
#openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt. -days 1000
I don't know where am I going wrong? Hope someone can help me out with this. By the way, my computer system is windows. thank you very much for your help.