Commit efdb3c6
Embassy MQTT client: TLS support (#175)
* docs(design): add 044 — Embassy MQTT client TLS
Resolves 042 §8.1 option 1: embedded-tls 1.3 over the Embassy TCP socket
with rustpki certificate verification, injected TRNG entropy, an SNTP time
source, DNS resolution, and broker authentication — plus the gamma wiring
and the open questions (CA distribution, record-size negotiation).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* feat(mqtt-connector): TLS, auth, and SNTP time source for the Embassy client
Implements design 044: mqtts:// broker support behind a new embassy-tls
feature.
- embedded-tls 1.3 session over the Embassy TCP socket; rustpki (pure
Rust, rsa+p384) certificate verification against an app-embedded root
CA; SNI + hostname verification from the broker URL (IP-literal mqtts
URLs are rejected at build()).
- Entropy injected via TlsOptions (&'static mut dyn CryptoRngCore) — the
app owns the TRNG; buffers are app-provided statics (D3, D10).
- Connector-internal SNTPv4 task (UDP + DNS) backs the TlsClock; the
first handshake waits for time sync so validity is always checked (D4,
D5). The wire codec is feature-independent and host-tested.
- The TLS manager loop is a connector-local port of
mountain-mqtt-embassy's run() (which hard-codes a plain TcpSocket);
the session speaks a custom Connection impl tracking decrypted
plaintext + socket readiness, and re-subscribes inbound routes per
session. The plain path is untouched (D6).
- with_credentials() feeds MQTT CONNECT on both transports; the fork
submodule gains upstream 0.4's ConnectionSettings::with_auth/
authenticated (aimdb-dev/mountain-mqtt@89a7129) (D8).
- make check gains the embassy-runtime,embassy-tls,defmt clippy leg.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(audit): update advisories to ignore known vulnerabilities in dependencies
* refactor: remove design references from mqtt-connector doc comments
* chore: remove unused dependencies from Cargo.lock and deny.toml
* Implement TLS support in the Embassy MQTT connector
- Added `embassy_tls` feature to enable TLS connections using `embedded-tls`.
- Introduced `TlsOptions` for configuring TLS parameters, including read and write buffers.
- Updated the MQTT connection logic to handle both plain and TLS connections based on the feature flag.
- Implemented SNTP for time synchronization to ensure certificate validity during TLS handshakes.
- Enhanced error handling for IP literals in broker URLs, rejecting IPv6 literals and warning for IPv4 literals.
- Updated documentation and examples to reflect the new TLS capabilities and usage instructions.
* feat: update heap size for MQTT demo and adjust binary path in flash script
* docs(changelog): record Embassy MQTT TLS support (design 044, WP7)
Adds Unreleased entries in the root and aimdb-mqtt-connector changelogs
for the embassy-tls feature, with_tls/with_credentials, and the SNTP
time source landed in the preceding commits.
* refactor(mqtt-connector): reuse upstream session loop; fix plain-path resubscribe
The Embassy connector no longer copies mountain-mqtt-embassy's session loop
(`State`/`ChannelEventHandler`/`try_action`/`handle_messages`, ~195 lines). It
now calls the newly-public upstream `handle_messages`, so the plain and TLS
paths share one keep-alive/action-dispatch/event implementation and can't drift.
The plain `mqtt://` path switches to `run_with_subscriptions`, which
re-subscribes the inbound topics on every connection. Previously it queued
subscribe actions once at startup, so subscriptions were silently lost after a
reconnect. Bumps the mountain-mqtt submodule to the matching upstream change.
Net: -215/+30 in the connector; behaviour on the TLS path is unchanged.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* chore(embassy): re-pin submodule to aimdb-dev/embassy main (217dbc9e1)
Moves the `_external/embassy` pin from `20f6d85e8` (the standalone #6390
poll-methods commit) to the fork's main `217dbc9e1`, which merges that commit
onto current upstream. No code change — 217dbc9e1's tree contains the same
poll-method additions; this just points the pin at the fork's main line so the
branch tracks main instead of a feature commit.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* chore(embassy): refresh fork main to upstream + keep #6390 carry
Re-pins `_external/embassy` to d60764b5 — the aimdb-dev/embassy fork main merged
up to current embassy-rs upstream (124 commits) with the #6390 public
poll_next_message / poll_changed carry retained. Verified compiling on
thumbv7em-none-eabihf: embassy-adapter, mqtt-connector (embassy-tls), demo binary.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: test <test@test.local>1 parent b5658b4 commit efdb3c6
21 files changed
Lines changed: 1896 additions & 81 deletions
File tree
- .cargo
- _external
- aimdb-mqtt-connector
- src
- docs/design
- examples/embassy-mqtt-connector-demo
- src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| 108 | + | |
108 | 109 | | |
109 | 110 | | |
110 | 111 | | |
| |||
0 commit comments