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 cert refresh recovers from sleep #1771

Merged
merged 1 commit into from
Jan 20, 2024
Merged

Conversation

ttosta-google
Copy link
Collaborator

@ttosta-google ttosta-google commented Jan 10, 2024

When a computer wakes from sleep after more than ~1 hour and a client tries to connect, the internal certificate cache will have an expired certificate. As a result, clients who tried to connect after sleep would see bad certificate errors which would resolve only once the remaining refresh duration expired (sleep time + remaining duration).

This commit adds code to check if the client certificate is expired and immediately triggers a blocking refresh if it is. This means that in the case where a cached certificate has expired, it will be discarded and a new one will be retrieved before continuing with the connection.

Fixes #1558

@ttosta-google ttosta-google force-pushed the fix-refresh branch 3 times, most recently from b3e080c to 729a370 Compare January 12, 2024 20:14
@ttosta-google ttosta-google marked this pull request as ready for review January 15, 2024 13:47
@ttosta-google ttosta-google requested a review from a team as a code owner January 15, 2024 13:47
Copy link
Member

@enocom enocom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great. Let's add a unit test to make sure we don't remove this code in the future.

@ttosta-google ttosta-google force-pushed the fix-refresh branch 2 times, most recently from cd5849d to dfeacd4 Compare January 19, 2024 21:20
@ttosta-google
Copy link
Collaborator Author

Added a unit test.

Copy link
Member

@enocom enocom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding a unit test. LGTM.

@ttosta-google ttosta-google merged commit 560d8cb into main Jan 20, 2024
16 checks passed
@ttosta-google ttosta-google deleted the fix-refresh branch January 20, 2024 01:28
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.

Recover gracefully from laptop sleep
3 participants