astarte-platform / stream-qt5-test

Simple Qt5 data generator that streams data to Astarte
http://astarte-platform.org/
Apache License 2.0
6 stars 9 forks source link

Certificate error when building Qt5 app locally. #40

Closed vjacob closed 1 year ago

vjacob commented 1 year ago

Hi all,

I'm trying to build the provided stream-qt5-test example on my local machine (Ubuntu 22.04) running a local instance of Astarte 1.0.4. I followed the 5 minutes guide and all is running well since the docker image of the Qt5 stream application runs OK and can post values to Astarte. When I build the Qt5 application locally using Qt 5.15.3, I get an SSL error on the Mosquitto transport connection (see below). This is after pairing a new device, which seems to run well. I can also see the device in the dashboard, where it says 'Never connected'. When I remove the IGNORE_SSL_ERRORS=true flag on the docker image, that image also fails to connect. So I'm pretty sure I need to somehow turn off client certificate validation or at least ignore errors on my build. However, I have no idea how to proceed as such.

It is to be noted I also built the SDK myself. Maybe a certain build setting needs to be used?

Thanks for any pointers.

_Buildversion: "OpenSSL 3.0.2 15 Mar 2022" Runversion: "OpenSSL 3.0.2 15 Mar 2022" Supports SSL: true hyperdrive.transportdatabasemanager: Found these migrations: QHash((1, "/usr/share/hyperdrive/transport-astarte/db/migrations/001_create_cachemessages.sql")(2, "/usr/share/hyperdrive/transport-astarte/db/migrations/002_create_persistententries.sql")) hyperdrive.transportdatabasemanager: Latest schema version is 2 astarte.defaultcredentialssecretprovider: Registering the device hyperdrive.mqttclientwrapper: Mosquitto is up! hyperdrive.mqttclientwrapper: MOSQUITTO LOG! OpenSSL Error[0]: error:0A000086:SSL routines::certificate verify failed 0 : "0.86403" astarte-device-sdk: No producers for interface "org.astarte-platform.genericsensors.Values" 0.628319 : "0.81829" astarte-device-sdk: No producers for interface "org.astarte-platform.genericsensors.Values"

vjacob commented 1 year ago

After a lot of digging, I found that one can set a flag in the device configuration file (in the astarte-device-xxx-conf folder) 'ignoreSslErrors' which can then be set to true. From that point on, I got a valid connection where my locally built Qt5 app was successfully producing values for Astarte.