TLS error when connecting to Hermetry with mosquitto_pub on Windows, how to get verbose logs?
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.
Saha cihazının firmware’ini yazmadan önce bağlantıyı Windows 10 dizüstünden mosquitto istemcisiyle denemek istiyorum. Mosquitto 2.0.18, resmi Windows kurulumu. Cihazı Hermetry’de açtım, access token aldım.
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.
Başka hiçbir şey yazmıyor. Broker benim değil, onun loguna bakamıyorum. İstemci tarafında ayrıntılı log almanın yolu nedir? Eskiden mosquitto.conf’ta log_type all vardı ama o broker için sanırım.
Translated from Türkçe by AI ·
Add -d, it gives debug output.
-d ekle, debug çıktısı verir.
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.
Ekledim. Sadece Client null sending CONNECT ve arkasından aynı TLS hatası. CONNACK bile gelmiyor yani el sıkışmada kalıyor.
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.
CONNACK gelmiyorsa TLS el sıkışmasında takılıyorsun. Komutunda iki şey var, ikisi de bunu yapar.
Birincisi IP ile bağlanıyorsun. Hermetry SNI istiyor, yani istemci el sıkışmada sunucu adını göndermeli; IP ile bağlanınca bu olmuyor ve el sıkışma düşüyor. Cihazın Connection details kartındaki host adını kullan, kendi bölgenin adresini.
İkincisi Windows’taki mosquitto istemcisi sistemin sertifika deposunu kendiliğinden kullanmıyor. 2.x sürümlerinde --tls-use-os-certs var, ya da elindeki bir CA paketini --cafile ile ver. Ben ilk denememde ikisini de unutmuştum, birebir aynı mesajı aldım.
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}"
Bağlantı açılınca bundan sonraki hataları (CONNACK 4, 5 gibi) cihazın Log sekmesinde nedeniyle birlikte görürsün; 5’in nedeni cihaza hiç gönderilmiyor, sadece orada yazıyor. Tablo burada: Cihaz bağlanmıyor.
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.
Host adı + –tls-use-os-certs ile geçti, CONNACK 0, PUBACK geldi. IP ile denememin sebebi kurumdaki DNS’in o sırada çalışmaması, sonra da unutmuşum. Sağ olun.
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.
Cihazda da aynı şey geçerli, firmware’de IP sabitlemeyin. Bizim bir RTU’da öyle yapılmıştı, aylarca neden bağlanmadığını aradık.
- 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.

