'Mosquitto Connection Errors

I have a Mosquitto 2.0.14 broker running in a Windows server 2019. I have following configs in mosquitto.conf:

listener 1883 localhost
allow_anonymous true

listener 8883
protocol mqtt
allow_anonymous false
password_file C:\mosquitto\password.txt
certfile C:\Certbot\live\dev-mqtt-broker.mysite.com\cert.pem
cafile C:\Certbot\live\dev-mqtt-broker.mysite.com\fullchain.pem
keyfile C:\Certbot\live\dev-mqtt-broker.mysite.com\privkey.pem

listener 9002
protocol websockets
socket_domain ipv4
allow_anonymous false
password_file C:\mosquitto\password.txt

I can connect to it over all these ports using mqtt://, mqtts://, ssl:// and ws://, protocols from NodeJS Code using MQTT.js library and from third party MQTT Clients like MQTTX.

But when I try to connect my device using ssl:// protocol over port 8883, sometimes I get different kinds of errors in Mosquitto logs. Some of these errors are:

OpenSSL Error[0]: error:14094415:SSL routines:ssl3_read_bytes:sslv3 alert certificate expired

OpenSSL Error[0]: error:141CF06C:SSL routines:tls_parse_ctos_key_share:bad key share

OpenSSL Error[0]: error:1408F10B:SSL routines:ssl3_get_record:wrong version number (frequent)

OpenSSL Error[0]: error:1408F09C:SSL routines:ssl3_get_record:http request (frequent)

OpenSSL Error[0]: error:142090C1:SSL routines:tls_early_post_process_client_hello:no shared cipher

OpenSSL Error[0]: error:1417A0C1:SSL routines:tls_post_process_client_hello:no shared cipher

Client <unknown> disconnected due to protocol error.

Client <unknown> disconnected due to malformed packet.

I have spent considerable time trying to learn about these errors but I can't seem to understand what is happening.

Any help would be great. Thanks in advance.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source