Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ensure certificate expiration is correct #659

Merged
merged 3 commits into from Mar 5, 2021
Merged

Conversation

enocom
Copy link
Member

@enocom enocom commented Mar 5, 2021

This commit is a follow-on to #648 which only partially addressed the
issue reported in #643. In a previous commit, we ensured the associated
OAuth2 token was refreshed before requesting an ephemeral certificate.
However, the oauth2.TokenSource stored in certs.RemoteCertSource would
nonetheless report an unrefreshed token's expiration. As a result,
attempts to refresh the configuration would fail given the unrefreshed
token would expire too soon.

This commit takes a new approach by updating the leaf certificate's
expiration to be the earlier of the ephemeral certificate's expiration
or the token's expiration. It likewise removes any checks of the token's
expiration outside of certs.RemoteCertSource.

Fixes #643.

This commit is a follow-on to #648 which only partially addressed the
issue reported in #643. In a previous commit, we ensured the associated
OAuth2 token was refreshed before requesting an ephemeral certificate.
However, the oauth2.TokenSource stored in certs.RemoteCertSource would
nonetheless report an unrefreshed token's expiration. As a result,
attempts to refresh the configuration would fail given the unrefreshed
token would expire too soon.

This commit takes a new approach by updating the leaf certificate's
expiration to be the earlier of the ephemeral certificate's expiration
or the token's expiration. It likewise removes any checks of the token's
expiration outside of certs.RemoteCertSource.

Fixes #643.
@google-cla google-cla bot added the cla: yes label Mar 5, 2021
@enocom enocom marked this pull request as ready for review March 5, 2021 17:27
proxy/certs/certs.go Outdated Show resolved Hide resolved
proxy/certs/certs.go Outdated Show resolved Hide resolved
proxy/certs/certs.go Outdated Show resolved Hide resolved
@kurtisvg kurtisvg merged commit 2fd2504 into main Mar 5, 2021
@kurtisvg kurtisvg deleted the fix-cert-expiration branch March 5, 2021 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Getting "new ephemeral certificate expires too soon" message and having trouble connecting to database
3 participants