fix: select proper box certificate by SNI presence - #470
Merged
SciLor merged 2 commits intoAug 10, 2026
Merged
Conversation
Removing unnecvesarry test
SciLor
merged commit Aug 10, 2026
534fed4
into
toniebox-reverse-engineering:develop
32 checks passed
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.
Select the certificate presented by the box HTTPS listener based on whether the TLS ClientHello contains an SNI extension.
Connections without SNI use the existing TB1 certificate, while connections with SNI use the TB2 certificate. This allows TB1 and TB2 devices to share the same HTTPS listener while receiving the appropriate certificate.
The SNI-based behavior is documented in
docs/box-https-sni.md.Verification
Tested against commit
81b6d01usingOpenSSL 3.0.13 30 Jan 2024 (Library: OpenSSL 3.0.13 30 Jan 2024).Both connections target the same TeddyCloud HTTPS listener. The relevant difference is whether the TLS ClientHello contains an SNI extension.
Without SNI
$ openssl s_client -connect <target>:443 -showcerts -noservernameThe server presents the TB1 certificate:
Handshake:
With SNI
$ openssl s_client -connect <target>:443 -showcerts -servername <hostname>The server presents the TB2 certificate:
Handshake:
Result
The same TeddyCloud HTTPS listener selects different certificates based solely on SNI presence:
CN=TeddyCloud Server, RSA 2048)CN=tbs2.tonie.cloud, EC 384)This confirms that the SNI-based certificate selection works as intended.