Repository navigation
feat(cloud-relay): real TLS via stock espressif32 platform - #6
Merged
johnsonflix merged 3 commits intoMay 3, 2026
Merged
Conversation
The Tasmota slim framework-arduinoespressif32 v2.0.18 used by upstream WLED
envs strips mbedtls SSL and WiFiClientSecure entirely, making real MQTT-over-
TLS unlinkable from the cloud_relay usermod. This commit:
* Overrides the platform on each *_evolights env to stock
PlatformIO espressif32 @ 6.7.0 (full mbedtls + WiFiClientSecure).
Wrapped in EVOLIGHTS-ANCHOR: platform-stock-espressif32.
* Switches cloud_relay.cpp from plain WiFiClient to WiFiClientSecure with
setCACert(broker_ca) — fails CLOSED if no CA is pinned. Default port 8883.
* Switches ota_verifier.cpp to WiFiClientSecure for the artifact download.
Uses setInsecure() because the Ed25519 sig over (version|url|sha256) plus
the sha256 verify on the bytes is the documented trust anchor.
* Adds positive TLS guards to verify-evolights-integration.sh so a future
refactor that drops the platform override or reverts to plain WiFiClient
fails the integration check before it can ship.
Tested-by: tools/verify-evolights-integration.sh (59 passed, 0 failed)
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
WiFiClientSecure::setCACert stores the const char* pointer (not a copy). Document the actual lifetime constraint instead of claiming a copy that doesn't happen. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Stock espressif32 with full mbedtls SSL + WiFiClientSecure adds ~240 KB to the sketch vs the Tasmota slim framework. The default WLED_ESP32_4MB_1MB_FS partition (1.5 MB sketch slot) overflows by: esp32dev_evolights: 1812257 / 1572864 bytes (115.2%) esp32_eth_evolights: 1850985 / 1572864 bytes (117.7%) Switch both 4 MB envs to big_partitions = WLED_ESP32_4MB_256KB_FS.csv (1.875 MB sketch / 256 KB FS) — leaves ~80 KB headroom. The ESP32-S3 8 MB env was already on extreme_partitions and didn't overflow. Trade-off: LittleFS shrinks from 960 KB to 256 KB. WLED's preset/config storage is well under 256 KB in practice; if a deployment hits the wall they should move to an 8 MB board (and we already ship that variant). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Owner
Author
CI green at 0713ff7All 4 required checks pass:
The 4 MB ESP32 envs are tight (esp32_eth_evolights at 49 KB headroom). If we add more code to the cloud relay surface in the future, those two envs will need to either jump to an 8 MB part or shed something. The S3 env has 350 KB of room. |
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
The Tasmota slim
framework-arduinoespressif32v2.0.18 used by upstream WLED envs intentionally strips mbedtls SSL andWiFiClientSecure. Linking real TLS on top of that produces dozens ofundefined reference to mbedtls_ssl_*errors. This PR overridesplatform = espressif32 @ 6.7.0(PIO stock, full mbedtls + the upstreamWiFiClientSecure) on the*_evolightsenvs only, so upstream WLED envs are unaffected.Changes
platformio.ini:[evolights_common]now setsplatform = espressif32 @ 6.7.0and emptyplatform_packages. Each*_evolightsenv inherits these via explicitplatform = ${evolights_common.platform}lines so they win over the parent env's Tasmota platform. Wrapped in newEVOLIGHTS-ANCHOR: platform-stock-espressif32markers.usermods/cloud_relay/cloud_relay.cpp:WiFiClient g_tcp→WiFiClientSecure g_tls. Pinsg_tls.setCACert(g_caCertPem.c_str())before each connect. Fails CLOSED if no CA is pinned. NosetInsecure()anywhere. Default port stays 8883. Stale "TLS TODO" header replaced with a "TLS via stock platform" header.usermods/cloud_relay/ota_verifier.cpp: artifact download now goes over HTTPS viaWiFiClientSecure. UsessetInsecure()here because the Ed25519 sig overversion|url|sha256plus the sha256 verify on the bytes is the documented trust anchor (seeEVOLIGHTS-ANCHOR: ota-trust-model).tools/verify-evolights-integration.sh: new positive TLS guards —WiFiClientSecure g_tls,g_tls.setCACert(,new PubSubClient(g_tls), nosetInsecure()in cloud_relay.cpp, andplatform-stock-espressif32:platformio.inianchor. A future refactor that drops the platform override or reverts to plaintext fails the check.Test plan
bash tools/verify-evolights-integration.sh→ 59 passed, 0 failedesp32dev_evolightsbuilds greenesp32_eth_evolightsbuilds greenesp32s3dev_8MB_qspi_evolightsbuilds green