我正在尝试在我的本地网络和运行mqtt服务器的云之间建立一个TLS mqtt桥,但无法创建它。
我已经配置了一个代理(称为remote_broker)来接受证书身份验证的连接(require_certificate、use_identity_as_username、密钥文件、证书文件和cafile),并且在配置客户端证书之后,我能够(使用mosquitto_pub和mosquitto_sub)直接发布和订阅主题。
当我再次尝试使用证书身份验证配置从另一个代理(称为local_broker)到远程代理的桥时,它失败了。remote_broker中的日志显示一个openssl错误,指出"peer没有提供证书“(参见remote_broker日志)。在本地服务器上,连接只是在SSL握手完成之前被声明为失败(参见下面的local_broker日志),因此甚至没有启动任何mqtt会话。从日志中看,似乎双方都在开始TLS握手,但它失败了,因为客户端没有正确地识别自己。
remote_broker日志:
2020-10-05T23:55:17Z: New connection from 127.0.0.1 on port 8883.
2020-10-05T23:55:17Z: OpenSSL Error[0]: error:1417C0C7:SSL routines:tls_process_client_certificate:peer did not return a certificate
2020-10-05T23:55:17Z: Socket error on client <unknown>, disconnecting.local_broker日志:
2020-10-05T23:55:17Z: Bridge local.mqttserver.local-remote doing local SUBSCRIBE on topic shelleys/#
2020-10-05T23:55:17Z: Bridge local.mqttserver.local-remote doing local SUBSCRIBE on topic tele/#
2020-10-05T23:55:17Z: Connecting bridge (step 1) local-remote (localhost:8883)
2020-10-05T23:55:17Z: Connecting bridge (step 2) local-remote (localhost:8883)
2020-10-05T23:55:17Z: Bridge mqttserver.local-remote sending CONNECT
2020-10-05T23:55:17Z: OpenSSL Error[0]: error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failurelocal_broker桥配置包含在conf.d目录内的一个文件中,内容如下(现在我使用ssh隧道来访问云计算机-因此使用本地主机名作为remote_broker IP地址的引用):
connection local_remote
address localhost:8883
topic shelleys/# out
topic tele/# out
bridge_cafile /etc/mosquitto/ca_certificates/RootCA.crt
bridge_certfile /etc/mosquitto/certs/bridgeClient.crt
#bridge_keyfile /etc/mosquitto/certs/bridgeClient.key参数bridge_keyfile被注释掉了,因为桥接的local_broker表现得像一个客户端(或者我是这么理解的),所以它不是必需的,但是我试着取消注释它,但是行为没有改变。
证书由相同的CA签名,其公共证书存在于两个代理中,并在local_broker中的“bridge_cafile”中的配置和remote_broker中的ca_file中引用。remote_broker证书已颁发给'localhost‘,以便它与提到的域名的地址参数相匹配。
我已经尝试了其他几个可能会影响连接行为的桥接TLS参数,比如“桥接不安全”、“桥接协议版本”、“bridge_require_ocsp”和“bridge_tls_version”,但都没有改变连接行为。
有没有人知道local_broker桥客户端发送证书以标识自身的配置中缺少了什么?
谢谢。
发布于 2020-10-07 06:08:39
@hardillb你是对的。关于你的评论,我已经检查并重复了我的配置,并在它成功连接之后。最终的配置如下所示。当我在激活bridge_keyfile的情况下测试它时,我不确定为什么它不能工作。
connection local_remote
address localhost:8883
topic shelleys/# out
topic tele/# out
bridge_cafile /etc/mosquitto/ca_certificates/RootCA.crt
bridge_certfile /etc/mosquitto/certs/bridgeClient.crt
bridge_keyfile /etc/mosquitto/certs/bridgeClient.key谢谢你的帮助。
https://stackoverflow.com/questions/64228002
复制相似问题