mosquitto_pub gives the following error: 1408F10B: SSL routines: ssl3_get_record: wrong version number
mosquitto_pub gives the following error: 1408F10B: SSL routines: ssl3_get_record: wrong version number
我已将 mosquitto 配置为侦听端口 8883,并为服务器生成了 letsencrypt SSL 证书。到目前为止一切顺利。
我可以成功测试 TLS 连接:
openssl s_client -connect mqtt.example.com:8883
给我证书和会话信息,mosquitto 的日志报告连接成功。
我也可以使用 paho python 库成功发布消息。
但是,当我尝试使用 mosquitto_pub
时,它会这样做:
$ mosquitto_pub -h mqtt.example.com -p 8883 -u foobar -P "" -t foobar -m test
Client connection from XX.XX.XX.XX failed: error:1408F10B:SSL routines:ssl3_get_record:wrong version number.
这似乎是一个常见问题,但我在网上搜索到的解决方案中有 none 似乎适用于我,因为它们通常涉及客户端使用 self-signed certificate 来标识自己。
所以我很难过。有谁知道是什么导致了这个错误?
要让 mosquitto_pub
尝试启动 SSL 连接,您需要提供指向 CA 证书位置的 --cafile
或 --capath
以验证代理。
如果没有这些选项,mosquitto_pub
或 mosquitto_sub
都不会尝试启动 SSL 会话,而是尝试连接正常的未加密 MQTT 连接。
在大多数 Linux 发行版中,您可以使用 --capath
并指向 /etc/ssl/certs
目录
对我来说,我找到的唯一解决方案是恢复到 mosquitto 1.5
我已将 mosquitto 配置为侦听端口 8883,并为服务器生成了 letsencrypt SSL 证书。到目前为止一切顺利。
我可以成功测试 TLS 连接:
openssl s_client -connect mqtt.example.com:8883
给我证书和会话信息,mosquitto 的日志报告连接成功。
我也可以使用 paho python 库成功发布消息。
但是,当我尝试使用 mosquitto_pub
时,它会这样做:
$ mosquitto_pub -h mqtt.example.com -p 8883 -u foobar -P "" -t foobar -m test
Client connection from XX.XX.XX.XX failed: error:1408F10B:SSL routines:ssl3_get_record:wrong version number.
这似乎是一个常见问题,但我在网上搜索到的解决方案中有 none 似乎适用于我,因为它们通常涉及客户端使用 self-signed certificate 来标识自己。
所以我很难过。有谁知道是什么导致了这个错误?
要让 mosquitto_pub
尝试启动 SSL 连接,您需要提供指向 CA 证书位置的 --cafile
或 --capath
以验证代理。
如果没有这些选项,mosquitto_pub
或 mosquitto_sub
都不会尝试启动 SSL 会话,而是尝试连接正常的未加密 MQTT 连接。
在大多数 Linux 发行版中,您可以使用 --capath
并指向 /etc/ssl/certs
目录
对我来说,我找到的唯一解决方案是恢复到 mosquitto 1.5