Unable to connect to MQTTS server due 2 expired CA root cert

Posted on
Mon Dec 20, 2021 7:34 pm
Turribeach offline
Posts: 429
Joined: Feb 06, 2015
Location: London, UK

Unable to connect to MQTTS server due 2 expired CA root cert

Hi,

I have two problems with the MQTT plugin. The first one is that the plugin is failing to connect to my desired MQTT server (I am following the instructions on the Glow IHD/CAD Indigo Plugin) but there is nothing useful in the logs. Here is what I see on Debug mode when I restart the plugin:

Code: Select all
   MQTT Connector Debug            MQTT Connector: logLevel = 10
   Started plugin "MQTT Connector 0.4.10"
   MQTT Connector                  Starting MQTT Connector
   MQTT Connector                  Glowmarkt MQTT Broker: Starting Device
   MQTT Connector Debug            Glowmarkt MQTT Broker: Broker __init__ address = glowmqtt.energyhive.com, port = 8883, protocol = 4, transport = tcp


The second problem is why the connection fails. I know why it fails but not sure how to fix it. The desired MQTT server I want to connect via MQTTS uses certificates issued by LetsEncrypt. Recently some of the root CA certs LetsEcrypt uses have expired and need to be updated. This caused lots of trouble for older devices (see here) like my MacOS Mojave MacMini. Technically Mojave is still under Apple Support but it seems they don't care much. I looked around on how to update the OS CA root certs but looks like this is not easy to do as the certs are protected by System Integrity Protection (see here).

Does anyone have an idea on how to solve this? It's not really a MQTT problem but thought I will ask here first.

Thanks!

Posted on
Mon Dec 20, 2021 7:52 pm
FlyingDiver offline
User avatar
Posts: 7221
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Unable to connect to MQTTS server due 2 expired CA root

In the config dialog for the MQTT Connector, check the box for library debug, then restart the plugin. That'll get some logging on the actual connection to the server. I should have done a better job pulling error info from the library into the plugin.

As for the Cert issue, it's possible to specify a cert file when opening the connection to the server, but I didn't implement that in the plugin. See the tls_set() function here: https://pypi.org/project/paho-mqtt/#option-functions. If this is something you need, open an issue on GitHub to request implementation.

As an aside, why that particular MQTT server?

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Tue Dec 21, 2021 3:34 am
Turribeach offline
Posts: 429
Joined: Feb 06, 2015
Location: London, UK

Re: Unable to connect to MQTTS server due 2 expired CA root

Hi,

Thanks for the quick reply. I did try enabling library debug but it made no difference:

Code: Select all
   Reloading plugin "MQTT Connector 0.4.10"
   Stopping plugin "MQTT Connector 0.4.10" (pid 95000)
   MQTT Connector                  Glowmarkt MQTT Broker: Stopping Device
   MQTT Connector                  Glowmarkt MQTT Broker: Disconnecting
   MQTT Connector                  Shutting down MQTT Connector
   Stopped plugin "MQTT Connector 0.4.10"
   Starting plugin "MQTT Connector 0.4.10" (pid 73275)
   MQTT Connector Debug            MQTT Connector: logLevel = 10
   Started plugin "MQTT Connector 0.4.10"
   MQTT Connector                  Starting MQTT Connector
   MQTT Connector                  Glowmarkt MQTT Broker: Starting Device
   MQTT Connector Debug            Glowmarkt MQTT Broker: Broker __init__ address = glowmqtt.energyhive.com, port = 8883, protocol = 4, transport = tcp
   MQTT Connector Debug            Glowmarkt MQTT Broker: Enabling library level debugging


Also if I enable Verbose Debugging Messages I start to see lots of MQTT Connector Debug log messages but related to

Code: Select all
   MQTT Connector Debug            Timer All Lights: deviceUpdated: id = 1657820952, devList = published_devices : (list)
   MQTT Connector Debug            Timer Study Light: deviceUpdated: doExcludes = False, listedDevice = False
   MQTT Connector Debug            Timer Study Light: deviceUpdated: id = 1963392240, devList = published_devices : (list)
   MQTT Connector Debug            Timer All Lights: deviceUpdated: doExcludes = False, listedDevice = False
   MQTT Connector Debug            Timer All Lights: deviceUpdated: id = 1657820952, devList = published_devices : (list)
   MQTT Connector Debug            Timer Study Light: deviceUpdated: doExcludes = False, listedDevice = False
   MQTT Connector Debug            Timer Study Light: deviceUpdated: id = 1963392240, devList = published_devices : (list)
   MQTT Connector Debug            Timer All Lights: deviceUpdated: doExcludes = False, listedDevice = False
   MQTT Connector Debug            Timer All Lights: deviceUpdated: id = 1657820952, devList = published_devices : (list)
   MQTT Connector Debug            Timer Study Light: deviceUpdated: doExcludes = False, listedDevice = False
   MQTT Connector Debug            Timer Study Light: deviceUpdated: id = 1963392240, devList = published_devices : (list)
   MQTT Connector Debug            Timer All Lights: deviceUpdated: doExcludes = False, listedDevice = False
   MQTT Connector Debug            Timer All Lights: deviceUpdated: id = 1657820952, devList = published_devices : (list)
   MQTT Connector Debug            Timer Study Light: deviceUpdated: doExcludes = False, listedDevice = False
   MQTT Connector Debug            Timer Study Light: deviceUpdated: id = 1963392240, devList = published_devices : (list)


I have raised issue 18 on GitHub. Do note the connection works when not using SSL/TLS.

As an aside, why that particular MQTT server? => Not sure about this question. Why do I want to connect to this server? Why does it fail on this server?

Thanks

Posted on
Tue Dec 21, 2021 5:34 am
FlyingDiver offline
User avatar
Posts: 7221
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Unable to connect to MQTTS server due 2 expired CA root

Turribeach wrote:
As an aside, why that particular MQTT server? => Not sure about this question. Why do I want to connect to this server? Why does it fail on this server?


Why do you want to use that server, given this problem? Why not run your own MQTT server?

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Wed Dec 22, 2021 5:35 am
Turribeach offline
Posts: 429
Joined: Feb 06, 2015
Location: London, UK

Re: Unable to connect to MQTTS server due 2 expired CA root

FlyingDiver wrote:
Why do you want to use that server, given this problem? Why not run your own MQTT server?


Because it has the data that I want. Is there a way to run my own MQTT server which connects to the external MQTT server outside of the plugin? I am not too familiar about MQTT hence the question.

Thanks

Posted on
Wed Dec 22, 2021 5:38 am
FlyingDiver offline
User avatar
Posts: 7221
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Unable to connect to MQTTS server due 2 expired CA root

Oh, if it's a third-party provider that's generating data via that MQTT broker, then you have to connect to it.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest

cron