pki: refuse a dead CA, and stop certificates outliving it - #38
Draft
allandegnan wants to merge 1 commit into
Draft
pki: refuse a dead CA, and stop certificates outliving it#38allandegnan wants to merge 1 commit into
allandegnan wants to merge 1 commit into
Conversation
Unfinished - pushed to save the work. The fixes are in and internal/pki passes; what is left is turning the two probe tests into real ones and running the full suite. Two findings, both confirmed before changing anything: A certificate can outlive the CA that signed it. A CA with an hour left issuing the shipped livedata profile's two hours produces a credential whose chain stops verifying an hour before its stated expiry: error 10 at 1 depth lookup: certificate has expired The holder is handed hours they do not have, and nothing warns anyone. An expired CA loads silently and keeps issuing. Load of a CA that lapsed a minute earlier returned nil, and it minted a certificate happily. The portal starts, the page renders, the download works, and every connection fails on a chain that cannot be verified. Load now refuses a CA that has expired or is not yet valid, and one without crlSign, which Gruff needs because it signs the revocation list with the same key. Issue and IssueServer bound validity to the issuer's own, which is honest - the portal shows the real expiry - and errors outright once the CA is gone, since a process outlives its startup checks. TODO: lifetime_probe_test.go is scratch. Replace TestProbeCertOutlivingItsCA and TestProbeLoadingAnExpiredCA with assertions, confirm they fail on main, then run make lint and the full race suite before opening a PR.
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.
Draft — not ready to merge. The fixes are in and
internal/pkipasses, but the tests are still scratch. See Remaining at the bottom.Two findings in
internal/pki, both confirmed before changing anything.A certificate can outlive the CA that signed it
IssuecomputesnotAfterasnow + dwith no reference to the issuer. A CA with an hour left, asked for the shippedlivedataprofile's two hours:and at a moment inside that gap,
openssl verify— which is what OpenVPN does on every connection:The holder is handed a credential claiming an hour it does not have. Nothing warns them, and the portal displays the longer figure.
An expired CA loads silently and keeps issuing
The portal starts, the page renders, the download succeeds — and every connection fails on a chain that cannot be verified. There is nothing in the logs pointing at the CA.
Change
Loadrefuses a CA that has expired or is not yet valid, and one withoutcrlSign— Gruff signs the revocation list with the same key, and a CRL from a CA lacking that usage is rejected by the servers that read it.IssueandIssueServerbound validity to the issuer's own. Shortening is the honest outcome:Credentials.NotAftercarries the real figure, so the portal shows what the holder actually has, and it is what a renewal would produce anyway. Once the CA is genuinely gone, issuance errors rather than minting something dead — a process outlives its startup checks, so this cannot rely onLoadalone.Remaining
lifetime_probe_test.gois scratch:TestProbeCertOutlivingItsCAandTestProbeLoadingAnExpiredCAlog rather than assert. They need rewriting as real tests.main.make lintand the full-racesuite — onlyinternal/pkihas been run so far.Noted, not changed
CRLsetsNumberto a random 63-bit integer. RFC 5280 wants it monotonically increasing. OpenVPN re-reads the file per connection and compares nothing, so it works today, and a refresh test depends on the randomness — flagging it rather than folding an unrelated change into this.