externalcas: make the certificate obtain timeout configurable - #57
Open
csgriggs wants to merge 2 commits into
Open
externalcas: make the certificate obtain timeout configurable#57csgriggs wants to merge 2 commits into
csgriggs wants to merge 2 commits into
Conversation
lego's Certificate.Timeout was never set, so the wait for the upstream CA to issue a certificate after finalization was capped at lego's 30s default even though RequestTimeout already allows 2 minutes. CAs whose post-finalization checks exceed 30s (CertiNext/InCommon does) made async finalization fail with "certificate: time limit exceeded" while the CA still issued the certificate, so every client retry minted another uncollected cert. Add cert_obtain_timeout (seconds, default 30 to preserve current behavior), validated to be non-negative and below the request timeout, and wire it into the lego client config. Follow-up to esnet#22, which fixed the downstream half.
cert_obtain_timeout is validated to stay below RequestTimeout(), which was hardcoded to 2 minutes, so the lego wait could never exceed ~110s. Add request_timeout (seconds, default 120 — unchanged behavior) so operators can raise both together, e.g. cert_obtain_timeout=300 with request_timeout=330. Motivation: CertiNext support has identified a CT log operator delaying issuance of their 30-day product and asks proxies to wait 300 seconds for finalization until it is resolved.
Author
|
Pushed a second commit adding Why 300: CertiNext support told us the delay is on their side — "one of the CT log operators is not responding within the expected timeframe" for their 30-day product — and asked that ACME proxies raise the finalization wait to 300 seconds until it is resolved. With 90 s we still saw |
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.
Fixes #56. Follow-up to #22, which fixed the downstream half of the same root cause.
Problem
createLegoClientinexternalcas/external.gonever setsCertificate.Timeout, so the wait for the upstream CA to issue the certificate after/finalizeis capped at lego's 30s default — even thoughRequestTimeout()already allows 2 minutes for the whole request. CAs whose post-finalization checks exceed 30s (CertiNext/InCommon has confirmed theirs can) make async finalization fail withcertificate: time limit exceededwhile the CA still issues the certificate, so every client retry mints another uncollected cert.Change
externalcas/config.go: new optionalcert_obtain_timeout(seconds) onauthority.config, with anObtainTimeout() time.Durationaccessor. Default is 30s, so existing deployments are unchanged.Validate()rejects negative values and values at or aboveRequestTimeout(), so the outer context still bounds the request.externalcas/external.go:clientConfig.Certificate.Timeout = cfg.ObtainTimeout().externalcas/config_test.go: cases for the default, a configured value, and both validation errors.README.md: documents the field in the config table.Example:
Testing
gofmt -l,go vet ./externalcas/, andgo test ./...are clean. We'll be running this against CertiNext production and can report back on the observed finalize-to-issue times.