LocalCache: reload cached certificates due for renewal from storage - #408
Open
mbardelmeijer wants to merge 1 commit into
Open
LocalCache: reload cached certificates due for renewal from storage#408mbardelmeijer wants to merge 1 commit into
mbardelmeijer wants to merge 1 commit into
Conversation
The local cache only changes when this instance reads or writes it, so it never learns of a renewal done by another instance. That is fine while the stale certificate is the one being served: it enters its renewal window, and the renewal path reads storage and picks up the peer's renewal. With several issuers it can go unnoticed indefinitely. An expired certificate from the preferred issuer in the local cache loses to a fallback issuer's certificate that is still valid, which is served and never triggers a storage read, while storage holds a renewed preferred certificate the instance never sees. A cached certificate due for renewal is exactly the one a peer is likely to have replaced, so read that issuer from storage instead. The read refreshes the local copy, so it is paid once per renewal; certificates that are not due are still served locally without touching storage.
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.
Follow-up to #402.
The local cache only changes when this instance reads or writes it, so it never learns of a renewal done by another instance. With a single issuer that heals itself: the stale certificate enters its renewal window and the renewal path reads storage. With several issuers it can go unnoticed indefinitely: an expired certificate from the preferred issuer in the local cache loses to a still-valid fallback certificate, which is served and never triggers a storage read, while storage holds a renewed preferred certificate the instance never sees.
A cached certificate due for renewal is exactly the one a peer is likely to have replaced, so
loadCertResourcenow reads that issuer from storage instead. The read refreshes the local copy, so it is paid once per renewal; certificates that are not due are still served locally without touching storage. If storage cannot be read, the cached copy is served as before.TestLocalCacheStaleCertRenewedByPeerreproduces the two-issuer scenario and fails without the fix.