Feature/tls verification fix#2
Merged
Merged
Conversation
…ication on FreeRTOS Add a cert_bundle_attach callback field alongside cacert in every iot-client config struct so ESP-IDF callers can pass esp_crt_bundle_attach for peer verification without needing a PEM string. The shared tls_connect() already supported this callback; this closes the plumbing gap. When cacert is NULL and cert_bundle_attach is set, TLS connections use VERIFY_REQUIRED with the platform cert bundle instead of falling back to VERIFY_NONE. cacert takes precedence when both are provided. Existing callers that set neither remain unchanged (VERIFY_NONE fallback). Updated 3 ESP-IDF examples (rtc-tcp-client, ota-demo, pair-by-ble) to use esp_crt_bundle_attach for iot-client TLS connections.
Covers both verification modes (.cacert PEM string for POSIX, .cert_bundle_attach platform callback for ESP-IDF/RTOS), precedence rules, all affected APIs, runtime CA fetch, sdkconfig requirements, troubleshooting, and best practices. Updates iot-client reference tables and sidebar navigation. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
3dd4651 to
98baa5c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
cert_bundle_attachcallback support to the IoT client module so that FreeRTOS/ESP-IDF devices can enable TLS certificate verification without needing a PEM string — closing a security gap where all iot-client connections fell back toVERIFY_NONE.Thread
cert_bundle_attachthrough all config structs (20 structs, ~33 assignment sites across 12 source files) from the public API (iot_client_config_t,iot_on_boarding_config_t,iot_qrcode_request_t) down to the two TLS connect sites (http_client_interface.c,mqtt.c). The sharedtls_connect()incommon/tls.calready supported this callback — this was purely a plumbing gap.Update 3 ESP-IDF examples (
rtc-tcp-client,ota-demo,pair-by-ble) to set.cert_bundle_attach = (tls_cert_bundle_attach_fn)esp_crt_bundle_attach, demonstrating verified TLS for iot-client connections.Add user-facing documentation (
docs-site/docs/guides/tls-cert-verification.md) covering both.cacert(PEM string, POSIX) and.cert_bundle_attach(platform callback, ESP-IDF/RTOS), with code examples, precedence rules, affected APIs, sdkconfig requirements, troubleshooting, and best practices. Updated the iot-client API reference and sidebar.