繁体   English   中英

在SSL上运行的mosquitto客户端和代理

[英]mosquitto-clients and broker running on SSL

我设法使用“让我们加密”证书使用SSL设置了代理。

我已经尝试测试连接到wss://broker:9002/mqtt的websockets客户端,并且该客户wss://broker:9002/mqtt在运行。 我还尝试使用mqtt.js命令行界面成功预订代理mqtts://broker:8883/mqtt上的主题。

但是,我无法使mosquitto_submosquitto_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与服务器上的证书相同。

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和mosquitto_pub命令的末尾添加“ --insecure”。 这允许客户端绕过将证书主机名与远程主机名匹配的检查。 我必须使用我生成的一些自签名证书来执行此操作。

这是这些命令的“ --help”相关注释:

--insecure : do not check that the server certificate hostname matches the remote
             hostname. Using this option means that you cannot be sure that the
             remote host is the server you wish to connect to and so is insecure.
             Do not use this option in a production environment.

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM