Skip to content

Fix BoringSSL dual-certificate default selection - #13712

Open
moonchen wants to merge 1 commit into
apache:masterfrom
moonchen:fix/boringssl-dual-cert-default
Open

moonchen wants to merge 1 commit into
apache:masterfrom
moonchen:fix/boringssl-dual-cert-default

Conversation

@moonchen

Copy link
Copy Markdown
Contributor

With BoringSSL, a default entry containing RSA and EC certificates serves only the last certificate to clients with no SNI or an unknown SNI. Clients restricted to the other key type fail with handshake_failure, despite a compatible certificate being configured.

After name and address lookups miss, select the existing * entry for the client’s key type. This reuses the entries maintained by certificate loading and secret updates; OpenSSL’s native dual-certificate selection is unchanged. A default action: tunnel entry on a transparent port also applies to these fallback clients.

Add regression coverage for both certificate orders, RSA and ECDSA clients, TLS 1.2 and TLS 1.3, and absent, unknown, and matching SNI. The original callback fails the regression with alert 40; the fix passes it with BoringSSL and preserves OpenSSL behavior.

Clients without a matching SNI can reject a dual-certificate default
when its last certificate has an incompatible key type. Select the
existing typed star entry after name and address misses, leaving native
dual-certificate selection unchanged and testing both orders with TLS
1.2 and TLS 1.3. This also honors a default tunnel action for
transparent connections.
Copilot AI lite review requested due to automatic review settings September 22, 2026 18:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

Review effort: Lite
Findings: 2 Medium severity · 1 Low severity

Open (3)
What changed in this PR

Adds regression coverage and a fallback certificate-context selection path to ensure BoringSSL serves an RSA or ECDSA default certificate that matches the client’s constrained signature algorithms when SNI lookup misses.

Changes:

  • Add a gold test that probes default vs named certificate selection across TLS 1.2/1.3, RSA/ECDSA, and multiple SNI scenarios using openssl s_client -sigalgs.
  • Add two replay definitions to exercise dual-certificate default selection with both RSA→EC and EC→RSA certificate ordering.
  • Update TLSCertSwitchSupport::selectCertificate to fall back to the stored * context for the requested key type when name and destination lookups miss.
File Description
tests/​gold_tests/​tls/​tls_dual_cert_default_client.py New helper client that validates selected cert/key type under restricted signature algorithms.
tests/​gold_tests/​tls/​tls_dual_cert_default.test.py New gold test wiring replay + helper client validation for both cert orders.
tests/​gold_tests/​tls/​replay/​dual_cert_default_rsa_ec.replay.yaml Replay covering RSA-first dual-cert default configuration.
tests/​gold_tests/​tls/​replay/​dual_cert_default_ec_rsa.replay.yaml Replay covering EC-first dual-cert default configuration.
src/​iocore/​net/​TLSCertSwitchSupport.cc Adds wildcard (*) fallback selection by key type when other lookups miss.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/gold_tests/tls/tls_dual_cert_default_client.py
Comment thread tests/gold_tests/tls/tls_dual_cert_default_client.py
Comment thread tests/gold_tests/tls/tls_dual_cert_default.test.py
@moonchen

Copy link
Copy Markdown
Contributor Author

[approve ci autest 2]

@moonchen

Copy link
Copy Markdown
Contributor Author

[approve ci autest 2]

@bryancall bryancall added this to the 11.0.0 milestone Sep 28, 2026
@bryancall
bryancall self-requested a review September 28, 2026 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants