No default certificate: a WARN on every TLS handshake, and an arbitrary certificate #418

Closed
opened 2026-11-17 21:13:02 +00:00 by jcoffey-dev · 1 comment
Owner

Reported in https://community.coffeylabs.org/t/232 (post 34): with 12 domains the log fills with WARN Multiple TLS certificates available (tls.multiple-certificates-available) total = 12, sometimes several a second.

CertificateResolver::resolve_certificate (crates/common/src/network/tls.rs) falls back to certs.get("*"), which only exists when SystemSettings defaultCertificateId is set. Nothing sets it except the console's "make default" (and the renewal repoint). Without it, every handshake with no SNI or an unknown name logs this at Warn and gets certs.values().next(), which is whichever certificate the hash map yields first.

Fix: when no default is set, fall back to the certificate that covers defaultHostname, and log at most once per certificate reload rather than on every handshake (or at Debug). Workaround meanwhile: pick a default on the Certificates page.

Reported in https://community.coffeylabs.org/t/232 (post 34): with 12 domains the log fills with `WARN Multiple TLS certificates available (tls.multiple-certificates-available) total = 12`, sometimes several a second. `CertificateResolver::resolve_certificate` (crates/common/src/network/tls.rs) falls back to `certs.get("*")`, which only exists when SystemSettings `defaultCertificateId` is set. Nothing sets it except the console's "make default" (and the renewal repoint). Without it, every handshake with no SNI or an unknown name logs this at Warn and gets `certs.values().next()`, which is whichever certificate the hash map yields first. Fix: when no default is set, fall back to the certificate that covers `defaultHostname`, and log at most once per certificate reload rather than on every handshake (or at Debug). Workaround meanwhile: pick a default on the Certificates page.
jcoffey-dev added this to the 27.1 milestone 2026-11-17 21:13:02 +00:00
jcoffey-dev added the
priority
p2
bug
labels 2026-11-17 21:13:02 +00:00
jcoffey-dev self-assigned this 2026-11-18 06:28:57 +00:00
Author
Owner

Fixed in #450. Thanks to the forum report in https://community.coffeylabs.org/t/232 (post 34) for spotting this.

When no default certificate is set, the server now picks one as it loads its certificates: the one for its own hostname (or a wildcard on that domain), otherwise the one whose name sorts first, so handshakes without a matching name always get the same certificate. The tls.multiple-certificates-available warning is logged once per load, and only when no certificate covers the hostname, instead of on every handshake. A default chosen on the Certificates page still takes precedence.

It will be in the next 27.1 release candidate.

Fixed in #450. Thanks to the forum report in https://community.coffeylabs.org/t/232 (post 34) for spotting this. When no default certificate is set, the server now picks one as it loads its certificates: the one for its own hostname (or a wildcard on that domain), otherwise the one whose name sorts first, so handshakes without a matching name always get the same certificate. The `tls.multiple-certificates-available` warning is logged once per load, and only when no certificate covers the hostname, instead of on every handshake. A default chosen on the Certificates page still takes precedence. It will be in the next 27.1 release candidate.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: inbuxa/inbuxa-server#418