Repository navigation
servers: reload renewed web certificates without a restart - #2081
Merged
Merged
Conversation
sh-agents
marked this pull request as ready for review
November 18, 2026 15:30
epoberezkin
reviewed
Nov 19, 2026
|
|
||
| checkHTTPSCredentials :: CredentialCheck | ||
| checkHTTPSCredentials (X.CertificateChain cc, _k) = | ||
| -- LetsEncrypt provides ECDSA with insecure curve p256 (https://safecurves.cr.yp.to) |
Member
There was a problem hiding this comment.
the comment is confusing. When it happens? What happens when it happens?
Author
There was a problem hiding this comment.
The comment comes from #1327 and moved here with checkHTTPSCredentials.
checkHTTPSCredentials is applied to smp-server's web certificate at start and on every reload. A certificate that isn't 4096-bit RSA is rejected: at start, smp-server exits with an error; on reload, the rejection is logged and the old certificate stays in use.
The comment means Let's Encrypt's ECDSA curves (P-256, P-384) are not safe curves, which is why RSA is required.
epoberezkin
approved these changes
Nov 19, 2026
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.
smp-server and xftp-server read the web certificate (
[WEB] certandkey) at start, so a renewed Let's Encrypt certificate is served only after a restart; a server that runs longer than 60 days after the last restart serves an expiring, then an expired certificate to browsers and web clients.Plan: plans/2026-11-17-reload-web-certificates.md
Changes
ReloadableCredential:TVarwith the credential in use, read inonServerNameIndicationat these handshakes:credentialCheckInterval(60 s), the files are parsed and compared with the credential in use. Changed files are accepted only with the private key of the certificate (checkKeyPair) and, on smp-server, with an RSA key of at least 4096 bits, as at start. The previous credential is kept in use after a rejection; a newweb.crtcopied before itsweb.keyis handled this way.checkLoadedCredential. xftp-server with[WEB] httpsand[WEB] static_pathbuilds twoReloadableCredentialvalues from the same files, used by the SNI listener and the separate port; each event is logged twice, by their two reload threads.CredentialError;IOExceptionandPEMErrorfrom reading the files are caught.withCredentialReload, together with the listener in which theTVaris read.withCredentialReloadis called in:runTransportServerSocketState, for SNI on smp-server and xftp-server;runHTTPSServer, for the separate HTTPS port.invalid credential, and unreadable files are reported the same way; the exit code is 1, as before. On the separate HTTPS port, theCredentialErroris logged with its reason. smp-server with an empty certificate file exits withError: no certificate, where it gaveunsupported HTTPS credentials, required 4096-bit RSAbefore.minHTTPSRSAKeyBits(4096), also in the error message and the certbot hint.server.crt,server.key) is read at start only, as before.Cryptography
checkKeyPairis listed inprotocol/crypto-registry.mdas a restricted use. In tls 1.9, only the key types of a credential and the curve of an EC private key are checked (isDigitalSignaturePair), and every handshake with a mismatched pair would be aborted.The public key of the leaf certificate is compared with a public key obtained from the private key file. Sources of that key:
toPublicof the private key;pointBaseMulof the private scalar, after the certificate point is decoded withunserializePointand validated, and the curve names are found equal. Other curves are rejected withCEUnsupportedCurve: only P-256 keys are used for signatures in tls 1.9 (kxSupportedPrivKeyEC), and every handshake with a P-384 or P-521 credential would be aborted. The check of the server type is applied first, so that smp-server rejects a reloaded EC certificate with the error given at start.Other key types are rejected.
pointBaseMulis computed in variable time, once per change of the files in each reload thread.Tests
web.crt, thenweb.key, with the certificate served to an SNI client checked at each step. Listeners:checkHTTPSCredentials, RSA 2048 is rejected.prExceptionequal toNothing:Error: unsupported HTTPS credentials, required 4096-bit RSA;invalid credential: no private key.CENoPrivateKeyis thrown for an empty key file.CEKeyMismatchwith another key of the same type;CEKeyMismatch;CEUnsupportedKeyType;CENoCertificate;CEReadErrorandCEPEMError;CEInvalidECPoint;CEUnsupportedCurve;CEKeyMismatch.checkLoadedCredential): an ECDSA P-384 pair is rejected withCEUnsupportedHTTPSKeyundercheckHTTPSCredentials(smp-server) and withCEUnsupportedCurveunderacceptCredential(xftp-server).checkHTTPSCredentials: an empty certificate chain is rejected withCENoCertificate.checkLoadedCredential): unchanged files, a rejection and its repetition, another mismatched pair and a load error after it, a repeated load error, an accepted renewal, and the check of the server type.