簡體   English   中英

在哪里可以找到 mosquitto_sub 和 pub 的 ca 證書?

[英]Where do I find the ca certificates for mosquitto_sub and pub?

在這篇啟用 TLS 的 mosquitto_sub文章中,我了解到您需要為 mosquitto_sub(和 pub)提供一個 capath 或 cafile 選項,但我無法確定這些文件/路徑的來源。

早在 10 月,我就能夠從我的台式計算機(運行mosquitto_sub -h mymosquitto.com -p 8883 -v -t 'jim/#' -u <u> -P <pw> --capath ssl/certs 19 )。 那不再起作用了。 我做了一個 apt install ca-certificates 並在/usr/share/ca-certificates/mozilla/中找到了 .crt 文件,但是當我使用該路徑時,它仍然給我:錯誤:發生 TLS 錯誤。

這是運行 Let'sencrypt 的 Ubuntu 18.04 服務器。 我試圖將--cafile指向來自以下的 chain.pem 文件:

allow_anonymous false
password_file /etc/mosquitto/pwfile

listener 1883 

listener 8883
certfile /etc/letsencrypt/live/mymosquitto.com/cert.pem
cafile /etc/letsencrypt/live/mymosquitto.com/chain.pem
keyfile /etc/letsencrypt/live/mymosquitto.com/privkey.pem

但這也沒有用。 有人可以幫我理解我應該做什么嗎?

mosquitto_sub手冊頁:

--capath

定義包含受信任的 PEM 編碼 CA 證書的目錄的路徑。 用於啟用 SSL 通信。

要使 --capath 正常工作,證書文件必須以“.crt”作為文件結尾,並且每次添加/刪除證書時都必須運行“openssl rehash [path to capath]”。

如果您想使用證書目錄,您必須確保提到的openssl rehash命令已在該目錄上運行。

如果您想將letsencrypt --cafile中的文件與fullchain.pem文件一起使用

我重新考慮了自己的處境。 由於我的證書每 3 個月左右重新生成一次,我將不得不使用新文件重做我的應用程序,所以我決定只使用 go 來滾動我自己的。 我使用這個網站做到了這一點: http://www.steves-internet-guide.com/mosquitto-tls/我回到了 10 月份的位置。感謝 hardillb 的建議。

吉姆。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM