错误的SSL/TLS连接在MQTT中与蚊子经纪人
我试图在覆盆子和蚊子经纪人之间使用openssl使用SSL/TLS加密连接。为此,我输入了以下命令:
openssl genrsa -des3 -out ca.key 2048
openssl req -new -x509 -days 2000 -key ca.key -out ca.crt
openssl genrsa -out server.key 2048
openssl req -new -out server.csr -key server.key
openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt -days 410
然后,我将CA_CERTIFIFIFICATES文件夹在/etc/Mosquitto/ca_certificates下移动,并在/etc/etc/Mosquitto/certs文件夹中移动服务器证书和键。
现在,我尝试Mosquitto -C Mosquitto.conf -v
它给了我:
1653586436: The 'port' option is now deprecated and will be removed in a future version. Please use 'listener' instead.
1653586436: mosquitto version 2.0.12 starting
1653586436: Config loaded from mosquitto.conf.
1653586436: Opening ipv4 listen socket on port 8883.
1653586436: Opening ipv6 listen socket on port 8883.
1653586436: Error: Unable to load CA certificates. Check cafile "c:\etc\mosquitto\ca_certificates\ca.crt".
1653586436: Error: Unable to load server certificate "c:\etc\mosquitto\certs\server.crt". Check certfile.
1653586436: OpenSSL Error[0]: error:02001002:system library:fopen:No such file or directory
1653586436: OpenSSL Error[1]: error:20074002:BIO routines:file_ctrl:system lib
1653586436: OpenSSL Error[2]: error:140DC002:SSL routines:use_certificate_chain_file:system lib
我在Mosquitto.conf
中所拥有的是:
port 8883
cafile c:\etc\mosquitto\ca_certificates\ca.crt
certfile c:\etc\mosquitto\certs\server.crt
keyfile c:\etc\mosquitto\certs\server.key
您对我的位置有任何了解错误?
I am trying to use a SSL/TLS encryption connection with openssl between a raspberry and the mosquitto broker. To do so, I have entered the following commands:
openssl genrsa -des3 -out ca.key 2048
openssl req -new -x509 -days 2000 -key ca.key -out ca.crt
openssl genrsa -out server.key 2048
openssl req -new -out server.csr -key server.key
openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt -days 410
Then I have move the ca_certificates folder under /etc/mosquitto/ca_certificates and also the server certificate and key in the /etc/mosquitto/certs folder.
Now, I try to mosquitto -c mosquitto.conf -v
it gives me:
1653586436: The 'port' option is now deprecated and will be removed in a future version. Please use 'listener' instead.
1653586436: mosquitto version 2.0.12 starting
1653586436: Config loaded from mosquitto.conf.
1653586436: Opening ipv4 listen socket on port 8883.
1653586436: Opening ipv6 listen socket on port 8883.
1653586436: Error: Unable to load CA certificates. Check cafile "c:\etc\mosquitto\ca_certificates\ca.crt".
1653586436: Error: Unable to load server certificate "c:\etc\mosquitto\certs\server.crt". Check certfile.
1653586436: OpenSSL Error[0]: error:02001002:system library:fopen:No such file or directory
1653586436: OpenSSL Error[1]: error:20074002:BIO routines:file_ctrl:system lib
1653586436: OpenSSL Error[2]: error:140DC002:SSL routines:use_certificate_chain_file:system lib
What I have in the mosquitto.conf
is:
port 8883
cafile c:\etc\mosquitto\ca_certificates\ca.crt
certfile c:\etc\mosquitto\certs\server.crt
keyfile c:\etc\mosquitto\certs\server.key
Do you have any idea of where is my error?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我只是解决了这个问题。问题是,蚊子无法阅读文件不是因为许可问题,而是因为filepaths。
所以事情是,在定义蚊子中的filepath时,我必须使用:
而不是:
I just solved the issue.The problem was that mosquitto was not capable of reading the files not because of permission issues but because of the filepaths.
So the thing was that when defining the filepaths in the mosquitto.conf I had to use:
Instead of:
Mosquitto_pub
的默认端口是1883,您已经配置了蚊子以使用端口8883正确的命令行是
因为它甚至没有到任何SSL的东西
mosquitto_pub
's default port is 1883, you have configured mosquitto to use port 8883The correct command line is
As it is this isn't even getting to any SSL stuff