1
我設法使用Let's Encrypt證書使用SSL設置代理。mosquitto-clients and broker running on SSL
我試過測試一個連接到wss://broker:9002/mqtt
的websockets客戶端,它工作。我也嘗試使用mqtt.js
命令行界面成功地訂閱經紀人mqtts://broker:8883/mqtt
上的主題。
但是,我無法獲得mosquitto_sub
和mosquitto_pub
的工作。 我試着用,
$ mosquitto_sub -h www.my-host.com.ar -p 8883 -t hello -d --cafile fullchain.pem
Client mosqsub/21069-atlantis sending CONNECT
Error: A TLS error occurred.
其中fullchain.pem是相同的CA證書這是在服務器上。
的mosquitto.log的經紀人顯示,
1456709201: OpenSSL Error: error:14094418:SSL routines:SSL3_READ_BYTES:tlsv1 alert unknown ca
1456709201: OpenSSL Error: error:140940E5:SSL routines:SSL3_READ_BYTES:ssl handshake failure
1456709201: Socket error on client <unknown>, disconnecting.
1456709206: New connection from <my-ip> on port 8883.
可能是什麼回事?我沒有爲mqtt.js
LIB提供任何證書......
這是我的經紀人配置(在兩個文件中分裂),
#################################
# /etc/mosquitto/mosquitto.conf #
#################################
pid_file /var/run/mosquitto.pid
persistence true
persistence_location /var/lib/mosquitto/
log_dest file /var/log/mosquitto/mosquitto.log
listener 1883
listener 8883
cafile /etc/letsencrypt/live/www.my-host.com.ar/fullchain.pem
certfile /etc/letsencrypt/live/www.my-host.com.ar/cert.pem
keyfile /etc/letsencrypt/live/www.my-host.com.ar/privkey.pem
include_dir /etc/mosquitto/conf.d
#############################################
# /etc/mosquitto/conf.d/websockets_ssl.conf #
#############################################
listener 9002
protocol websockets
cafile /etc/letsencrypt/live/www.my-host.com.ar/fullchain.pem
certfile /etc/letsencrypt/live/www.my-host.com.ar/cert.pem
keyfile /etc/letsencrypt/live/www.my-host.com.ar/privkey.pem
'mosquitto_sub -h -p 8883 -t測試--insecure -d'不停地嘗試發送CONNECT,而在經紀人日誌上說''例程:SSL23_GET_CLIENT_HELLO:未知協議' –
autorun
加,我的經紀人正在使用讓我們加密應該是有效的證書 – autorun