MQTTs - disable hostname verification

choses-lucas
Posts: 2
Joined: Thu Jan 19, 2023 3:14 pm

MQTTs - disable hostname verification

Postby choses-lucas » Fri Jan 20, 2023 7:40 am

I'm currently working on MQTTs using ESP-IDF on eclipse with the ESP-IDF plugin. My goal is to adapt an existing c++ library made for POSIX to ESP32. The library currently uses PAHO and I want to replace it with the native esp32 MQTT library. And I'm currently trying the MQTTs example called ssl_mutual_auth.

For the broker, I have a test RabbitMQ and I am using self-signed certificates. Those certificates work well with the existing library using PAHO. But to make this work since it's a test installation without any hostname, just an IP and test self-signed certificate, I need to disable the hostname verification (verify that the certificate matches the given host name). Here is the documentation of that function in PAHOc++ :https://eclipse.github.io/paho.mqtt.c/M ... 2931f573ce

Right now it seems that the MQTT client (the esp32) does not accept to connect to the MQTT broker (rabbitMQ) due to this hostname verification.

Is it possible to disable this hostname verification the same way it is done in PAHO?

ghost07
Posts: 36
Joined: Mon Oct 03, 2022 11:47 am

Re: MQTTs - disable hostname verification

Postby ghost07 » Mon Jan 23, 2023 9:15 am


ESP_YJM
Posts: 300
Joined: Fri Feb 26, 2021 10:30 am

Re: MQTTs - disable hostname verification

Postby ESP_YJM » Sat Jan 28, 2023 6:52 am

Yes, you can set skip_cert_common_name_check(https://github.com/espressif/esp-mqtt/b ... ent.h#L260) to true to skip check server hostname in CA.

choses-lucas
Posts: 2
Joined: Thu Jan 19, 2023 3:14 pm

Re: MQTTs - disable hostname verification

Postby choses-lucas » Fri Feb 03, 2023 12:59 pm

ESP_YJM wrote: Yes, you can set skip_cert_common_name_check(https://github.com/espressif/esp-mqtt/b ... ent.h#L260) to true to skip check server hostname in CA.
Thanks, it's exactly what I needed, tested and it is working as expected.

Who is online

Users browsing this forum: No registered users and 63 guests