Mosquitto-证书中的客户端代理启用了不提供证书的网桥



我正试图在本地网络和运行mqtt服务器的云之间建立TLS mqtt桥,但无法创建。

我已经配置了一个代理(称之为remote_broker(来接受证书身份验证的连接(require_certificate、use_identity_as_username、keyfile、certfile和cafile(,在配置了客户端证书后,我可以直接发布和订阅主题(使用mosquitto_pub和mosquitto_sub(。

当我尝试配置从另一个代理(称为local_broker(到远程代理的网桥时,再次使用证书身份验证,它失败了。remote_ broker中的日志显示openssl错误;同行没有出示证书";(请参阅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 failure

local_broker网桥配置包含在conf.d目录中的一个文件中,内容如下(目前我使用ssh隧道访问云机器,因此localhost名称作为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被注释掉了,因为桥接连接的localbroker表现得像一个客户端(或者我理解的那样(,所以不需要它,但我尝试取消它的注释,但行为没有改变。

证书由同一个CA签署,其公共证书存在于两个代理中,并在local_broker的"bridge_cafile"和remote_broker中的CA_file中的配置中引用。remote_broker证书已颁发给"localhost",因此它与提到的域名的地址参数匹配。

我尝试了其他几个可能影响连接行为的网桥TLS参数,如"bridge_insecure"、"bridge_procol_version"、"bridge_require_ocsp"one_answers"bridge_TLS_version",但都没有改变行为。

有人知道local_brokerbridge客户端发送证书并识别自身的配置中缺少什么吗?

谢谢。

@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

谢谢你的帮助。

最新更新