Repository navigation
Conversation
155bf55 to
5a11732
Compare
|
@KRZ303 A change of direction on this one, since it affects your patch. I went to package the Mbed TLS backend as prebuilt wheels, because shipping Before giving up on OpenSSL I checked whether it had any length-carrying PSK path at all. So I tried the other direction: a DTLS 1.2 client speaking only Against a server built from the appliance's own Mbed TLS 2.7.8, configured the way That server runs on a laptop, though. Your oven is the only real PSK device anyone working on this can reach. Would you run this against it? One script, no build, read-only: handshake, That branch is orphaned off It takes the host, identity and key from environment variables, which the script lists if you run it without them. The device id is reported as a match against one you supply, so the output is safe to paste here. I am leaving this PR open until that result is in. What happens to it afterwards depends on how the engine does on real hardware, and there is no sense settling that beforehand. |
Hah I was just experimenting with Mbed prebuilt wheels! |
|
@QuiteYellow Following up on your test request: I tested the Python client against my oven inside HA Core on October 3. It worked after fixing the engine and probe. The handshake used the full 16-byte PSK identity containing a zero byte. The corrected probe produced: Exit code was zero, with no stderr. This was one read-only GET; no appliance controls or security-resource writes. The changes are in #116, targeting your
I temporarily unloaded only the oven entry, then restored it. The oven resumed Observe mode, and the washer stayed loaded. The installed integration and protocol library were unchanged. The PR also documents runtime dependencies and includes 26 passing offline regression tests, including real OpenSSL exchanges with and without cookies. Since the hardware run, only documentation and tests changed; the engine and executable probe code are unchanged. This establishes a successful authenticated read on my oven. #116 contains the standalone script fixes and tests; library integration remains separate. |
|
@KRZ303 Merged as I reproduced the transcript failure this fix repairs. Building the reference server with The cause was a comment of mine that was right about the specification and wrong about when it applies. RFC 6347 4.2.1 excludes the initial ClientHello from the transcript, but only when a cookie round trip actually happens. I applied it unconditionally. The server now takes a The socket change was a good spot, because this repository already fixed that pattern in Now it is confirmed working, I ran a pass over this repository's earlier protocol fixes to check each one had been carried into the engine. One had not: it answered only the first HelloVerifyRequest and ignored any later one, which is the shape localthings#504 describes. Each cookie is answered now, with a cap so a server that only ever sends them cannot hold the handshake open. That is One question I could not settle by experiment. Did the oven actually frame its HelloVerifyRequest as DTLS 1.0, or was that change defensive? I rebuilt the reference server without its version pinning and still got 1.2 framing, so I cannot reproduce the condition your fix handles. The fix is correctly scoped either way and I have kept it. If you still have the probe output or a capture from that run, the record header on the HelloVerifyRequest is the only part I need. |
|
@Jason-Morcos this lands on your Nothing imports it, so it cannot merge as it stands. The ask is in the body, along with one question for you: routing PSK through this needs a verb |
|
@QuiteYellow I ran another read-only probe against the oven and recorded the incoming HelloVerifyRequest headers. The oven used DTLS 1.2 framing ( The handshake type was So the I should have distinguished that fixture-backed compatibility fix from the hardware result in my earlier reply. The original October 3 run did not record headers, so I cannot establish which framing the oven used then. I also tested your exact commit Exit code was zero, with no stderr. That run also received one HelloVerifyRequest with All 26 regression tests pass on |
|
@KRZ303 Closing this in favour of #117, which carries a pure-Python DTLS 1.2 ECDHE-PSK engine. Your oven runs are what showed the approach works, the engine includes your fixes from #116, and the one you tested at #117 wires the engine to nothing: What this patch and your work on it established stands regardless of which engine ships:
If you are willing to be tagged when a PSK change needs a hardware check before a release, say so and I will tag you. |
|
@QuiteYellow count me in, will be happy to test and generally contribute what I can :) |
|
@KRZ303 Thanks for doing the hardware runs and separating the oven's actual One correction to my earlier note on #16: the separately built Mbed TLS backend is no longer the only demonstrated way to carry that identity. Your standalone Python-engine runs establish another working path on the oven; #117 still needs the library connection wiring before normal I've now run #117's 331 new tests and replayed a retained refrigerator PSK server flight through that engine with synthetic credentials. It gets through ClientKeyExchange with the full identity. I've put the details, a reproduced repeated-cookie framing bug, and the connection-factory suggestion on #117 so they stay with the implementation. Our live washer probe today was inconclusive, so I'm not counting that as an additional hardware success. |
Why this is needed
My Samsung oven's owner UUID contains a NUL byte. I recovered the correct PSK, but OpenSSL couldn't send the full identity.
This follows #85. Its guard is correct: removing it would truncate the identity. This patch uses Mbed TLS for that case and preserves all 16 bytes.
What changed
TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256.What worked on my oven
My oven reports board prefix
LCD_R18_SCO_QMD_EU_22Kand SmartThings profileDA-KS-OVEN-0105X. I haven't checked the retail model number yet.I recovered its existing OwnerPSK from SmartThings on rooted Android 17. The recovery scripts and instructions are here.
On October 3, Mbed TLS 3.6.7 authenticated with the complete identity, and
GET /oic/dreturned my oven's expected device ID. I got the same result with the standalone native probe and the patched Python session, including inside my HA Linux runtime.After installing both patches, I imported the PSK and added the oven in HA. My certificate-based washer still loads too.
The oven currently exposes only a connection-mode sensor. Authentication works; full oven entity coverage doesn't. I haven't tested heating commands or used these tools to write OCF security resources.
Tests
The pre-deployment checks for
e41c902passed:cbor2==5.6.0andpyOpenSSL==23.1.0.A fresh Python 3.14 run also passed all 943 tests before I opened this PR.
Installation limits
The wheel includes C source, not a compiled native module. You need to build
_mbedtls_native.sofor your architecture and C library. Nothing compiles during authentication.For HA, I built a static Mbed TLS 3.6.7 module in a disposable container matching my HA image. I didn't replace HA's installed Mbed TLS package.
The existing CI doesn't build this optional module, so its native tests skip there. Native binary distribution still needs sorting out. I've tested macOS and my Linux HA target, not Windows or other appliances.
The companion LocalThings PR lets the integration accept identities supported by this transport. Credential extraction and oven capability support stay separate.