New: the AI firewall watches the whole platform and explains each incident in plain words. See how it works

TLS error when connecting to Hermetry with mosquitto_pub on Windows, how to get verbose logs?

TLS error when connecting to Hermetry with mosquitto_pub on Windows, how to get verbose logs?

Solved 5 3

Translated from Türkçe by AI ·

Before writing the firmware to the field device, I want to test the connection from my Windows 10 laptop with the mosquitto client. Mosquitto 2.0.18, official Windows installation. I opened the device in Hermetry and got an access token.

mosquitto_pub -h 185.x.x.x -p 8883 -u <token> -t v1/telemetry -m "{"t":21.4}" -q 1
Error: A TLS error occurred.

It doesn’t print anything else. The broker isn’t mine, so I can’t look at its log. What is the way to get detailed logs on the client side? Previously there was log_type all in mosquitto.conf, but I think that was for the broker.

♥ 0

Translated from Türkçe by AI ·

Add -d, it gives debug output.

♥ 1

Translated from Türkçe by AI ·

I added it. Only Client null sending CONNECT and then the same TLS error. CONNACK doesn’t even arrive, so it gets stuck in the handshake.

♥ 0

Translated from Türkçe by AI ·

If you’re not getting CONNACK, you’re stuck in the TLS handshake. There are two things in your command, and both cause that.First, you’re connecting by IP. Hermetry requires SNI, meaning the client has to send the server name during the handshake; when you connect by IP this doesn’t happen and the handshake fails. Use the host name from the Connection details card of your device, the address for your own region.Second, the mosquitto client on Windows does not use the system certificate store by default. In version 2.x there is --tls-use-os-certs, or you can pass a CA bundle you have with --cafile. On my first try I had forgotten both, and got exactly the same message.

mosquitto_pub -d -h <connection details'teki host> -p 8883 --tls-use-os-certs ^
  -i test-pc-01 -u <token> -t v1/telemetry -q 1 -m "{"t":21.4}"

Once the connection opens, you’ll see the following errors (such as CONNACK 4, 5) in the device’s Log tab, along with their causes; the cause for 5 is never sent to the device, it is only written there. The table is here: Cihaz bağlanmıyor.

Accepted solution♥ 7

Translated from Türkçe by AI ·

Passed with hostname + –tls-use-os-certs, got CONNACK 0, PUBACK arrived. The reason I tried with the IP was that the corporate DNS wasn’t working at that time, and then I forgot. Thanks a lot.

♥ 0

Translated from Türkçe by AI ·

The same applies to the device too, don’t set a static IP in the firmware. On one of our RTUs it was done that way, and for months we searched for why it wasn’t connecting.

♥ 0
Viewing 6 posts – 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

Join the conversation

Sign in to ask and answer, like helpful posts and mark the reply that solved your problem. Every contribution earns points and levels.

Share