TLS: without a default certificate, use the one for the server's hostname #450

Merged
jcoffey-dev merged 1 commits from fix/418-default-cert into main 2026-11-18 18:44:58 +00:00
Owner

Fixes #418 (reported in community t/232, post 34).

With several certificates and no default set (SystemSettings defaultCertificateId), CertificateResolver::resolve_certificate logged tls.multiple-certificates-available at Warn on every handshake without SNI or for an unknown name, and served whichever certificate the hash map yielded first.

  • parse_certificates now picks a default when none is set: the certificate for defaultHostname (exact name, then a wildcard on its domain), otherwise the one whose name sorts first. It goes in under *, the same slot an admin-set default uses, so the resolver's existing fallback finds it.
  • The event is logged once per certificate load, and only when the hostname isn't covered by any certificate.
  • A default set in the console still wins, as before.

Tests: fallback_default_certificate unit tests (hostname, wildcard on its domain, same choice every time without a match). cargo check -p common --all-targets, fmt and the fork checks are clean.

Fixes #418 (reported in community t/232, post 34). With several certificates and no default set (SystemSettings `defaultCertificateId`), `CertificateResolver::resolve_certificate` logged `tls.multiple-certificates-available` at Warn on every handshake without SNI or for an unknown name, and served whichever certificate the hash map yielded first. - `parse_certificates` now picks a default when none is set: the certificate for `defaultHostname` (exact name, then a wildcard on its domain), otherwise the one whose name sorts first. It goes in under `*`, the same slot an admin-set default uses, so the resolver's existing fallback finds it. - The event is logged once per certificate load, and only when the hostname isn't covered by any certificate. - A default set in the console still wins, as before. Tests: `fallback_default_certificate` unit tests (hostname, wildcard on its domain, same choice every time without a match). `cargo check -p common --all-targets`, fmt and the fork checks are clean.
jcoffey-dev added 1 commit 2026-11-18 18:34:45 +00:00
TLS: without a default certificate, use the one for the server's hostname
ci / fork-checks (pull_request) Skipped
ci / build (pull_request) Skipped
github/ci (branch) GitHub Actions
ci / github (pull_request) Successful in 9m45s
4e84dd1034
With several certificates and no default set, every handshake without
SNI or for an unknown name logged tls.multiple-certificates-available at
Warn and got whichever certificate the hash map yielded first.

Loading the certificates now picks a default when none is set: the one
for defaultHostname (exact, then a wildcard on its domain), otherwise the
one whose name sorts first. The event is logged once per load, and only
when the hostname isn't covered.

Fixes #418
jcoffey-dev merged commit 5a9fbe61cb into main 2026-11-18 18:44:58 +00:00
jcoffey-dev deleted branch fix/418-default-cert 2026-11-18 18:44:58 +00:00
Sign in to join this conversation.