小编den*_*sha的帖子

mosquitto TLS 用于远程 mosquitto_pub 的证书

我正在尝试使用 TLS1.2 使用 Lets 加密证书来设置 mosquitto MQTT 服务器。

我已经安装了 mosquitto 并设置了 Let encrpypt。我的 /etc/mosquitto/conf.d/default.conf 是

listener 1883 localhost

listener 8883
certfile /etc/letsencrypt/live/mqtt.atom.net/cert.pem
cafile /etc/letsencrypt/live/mqtt.atom.net/chain.pem
keyfile /etc/letsencrypt/live/mqtt.atom.net/privkey.pem
Run Code Online (Sandbox Code Playgroud)

在服务器上运行 mosquitto 我可以成功发布和订阅消息

Sub 
mosquitto_sub -h localhost -t test
hello

Pub
mosquitto_pub -h mqtt.atom.net -t test -m "hello" -p 8883 --capath /etc/ssl/certs/
Run Code Online (Sandbox Code Playgroud)

从互联网上的另一个系统(或 ESP32) - 尝试建立 TLS 连接时出现错误

mosquitto_pub -h mqtt.atom.net -t test -m "hello again" -p 8883
Error: The connection was lost.
Run Code Online (Sandbox Code Playgroud)

我需要将哪些文件/证书传递给 mosquitto_pub?

mosquitto tls1.2

5
推荐指数
1
解决办法
7161
查看次数

标签 统计

mosquitto ×1

tls1.2 ×1