Guys - hope someone can help point me in the right direction.
I have been a long term user of Mosquitto onprem, and want to bridge to HiveMQ Cloud (free).
I have googled and spend several hours playing with mosquitto.conf settings but cannot get HiveMQ messages to bridge down to the onprem Mosquitto.
Mosquitto shows ““Bridge Mosquitto sending CONNECT”… closely followed by " Client local. Mosquitto closed its connection”.
All 56 local mqtt devices work perfectly with Mosquitto and I have three test devices in HiveMQ cloud working fine. I can brown with MQTT Explorer to both brokers and all is working as expected.
I can only assume its something to do with TLS and lack of cert on the local Mosquitto that si wrong but cannot find any means to get capfile for the connection.
A typical pitfall, when trying to bridge mosquitto to HiveMQ is that you have to have the following setting in your mosquitto.conf
try_private false
HiveMQ does not support mosquitto’s proprietary bridging protocol and therefore you need to make sure that the mosquitto acts as a regular MQTT client.
In regards to the CA file:
You should not need a CA file, as the certificates for HiveMQ cloud are signed by a trusted CA.
It’s of course entirely possible that an older system might not have the CA included that we are using.
In this case you can simply created a CA file for yourself, using the openssl s_client
My only remaining try is to rehash the cert - which I have read may be an issue - which is weird as the cert does verify correctly when using one of the many online cert validators.
Note that I have insecure mode set - which I understood told Mosquitto to ignore an invalid cert (ie the host name does not match the cert … and HiveMQ is a wildcard cert from what I see).
I have not been able to even verify if the free HiveMQ product supports bridges!
Next idea… install HiveMQ locally… see if that works.
I faced the same problem as described in this thread.
I finally managed to get it working with non secure connection to hive. I works for me with the following configuration:
Messages published to my mosquitto local boker are published also to hivemq broker. When I publish to hivemq broker the client subscribing to my local broker gets the message. So, it works in both ways. Great!
However, my aim is to configure broker supporting ssl/tls.
I tried the following configuration (and some variations) but it does not work (showing only bridge section, everything before is not changed):
It does not connect at all. In log I have the following:
1636580374: Connecting bridge (step 1) hivemq (some_my_id_from_hive.s1.eu.hivemq.cloud:8883)
1636580374: Connecting bridge (step 2) hivemq (some_my_id_from_hive.s1.eu.hivemq.cloud:8883)
1636580374: Client local.bilbo.hivemq closed its connection.
‘bilbo’ is my local hostname.
It seems even not to try to open a connection to remote port 8883. Not binding to any socket locally?
My mosquitto is behind NAT and has non-routable IP.
Note that I can subscribe with mosquitto_sub without any issues. This works: mosquitto_sub -h some_my_id_from_hive.s1.eu.hivemq.cloud -p 8883 -u myusername -P mypassword -t 'mytopic'
I may be misunderstanding but it seems Hivemq has an expired certificate that fails validation. I noticed this connecting with MQTT-Explorer, I had to disable certificate validation for it to work.
My leftover question if anyone feels like helping me improve my understanding:
Is the HiveMQ cert really expired? Connecting with MQTT Explorer with validation on seems to confirm that it is.
Would downloading the expired certificate and putting it in the bridge_cafile solve this as well?
Is a bridge_cafile always required if the remote broker has ssl enabled?