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

Machine ID: Warn when returned cert TTL is less than expected #52833

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

timothyb89
Copy link
Contributor

This adds a warning when the returned certificate TTL is lower than requested, which can happen if max_session_ttl is set in a bot role.

Fixes #29579

This adds a warning when the returned certificate TTL is lower than
requested, which can happen if `max_session_ttl` is set in a bot
role.

Fixes #29579
// Calculate a rough TTL, assuming this was called shortly after the
// identity was returned. We'll add a minute buffer to compensate and avoid
// superfluous warning messages.
effectiveTTL := ident.TLSIdentity.Expires.Sub(time.Now()) + time.Minute
Copy link
Contributor Author

Choose a reason for hiding this comment

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

A bit janky and may have some minor false negatives due to the 1m buffer. Hopefully sane enough?

Comment on lines +432 to +435
l.WarnContext(ctx, "The server returned an identity shorter than "+
"the requested TTL, probably due to a `max_session_ttl` "+
"configured on a server-side role. It may not remain valid as "+
"long as expected.")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did some experimenting and found that bots can always fetch their own roles, so technically we could make some queries and log exactly which role caused the shortened TTL. Any thoughts on whether or not that would be worth the effort?

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.

Machine ID: Add warnings when max_session_ttl is exceeded in tbot configuration
1 participant