Mosquitto TLS/SSL SSL3_READ_BYTES: ssl handshake failure, Error: Success and sslv3 alert

Mosquitto TLS/SSL SSL3_READ_BYTES: ssl handshake failure, Error: Success and sslv3 alert

我尝试按照 mosquitto 显示的指南进行操作,但是一旦我启动了 mosquitto

mosquitto -c mosquitto.conf

定义ca.crt、server.crt、server.key

的端口、位置

然后我使用相同的 CA 文件按照类似的步骤对客户端密钥和证书进行签名。

然后启动客户端

mosquitto_pub -p [port] -h localhost --cafile [ca.crt filepath] -t "hello" -m "hello world"

当我在没有密钥和证书的情况下这样做时,我得到了

Error: Success

但是当我使用密钥和证书时

mosquitto_pub -p [port] -h localhost --cafile [ca.crt filepath] --cert [client.crt path] --key [client1.key path] t "hello" -m "hello world"

我明白了

Error:Success

在服务器端我看到以下错误

... routines:SSL3_READ_BYTES: sslv3 alert certificate unknown
... routines:SSL3_READ_BYTES: ssl handshake failure

我 运行 openssl 命令来验证 CA 批准两个生成的证书,它确实这样做了。

事实证明,在输入证书的详细信息时,我弄错了公用名部分的用途。我把它设置成服务器的ip地址后,一切正常

我遇到了同样的错误。我试过这样订阅:

mosquitto_sub -h ip_address -p 8883 -t topic --cafile /etc/mosquitto/ca_certificates/ca.crt -d.

将ip_addres替换为您在创建证书时写入的IP地址。在你的问题中,你写了localhost。如果您将其替换为 ip 地址,它将起作用。