-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Time-based transit key autorotation #13691
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me but I'd like one more person's eyes on it.
281aae0
to
71b5256
Compare
…ig update endpoints.
…ion happens simultaneously.
c45c835
to
edf7db2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Thanks y’all! |
p.Lock(true) | ||
} | ||
err = p.Rotate(ctx, req.Storage, b.GetRandomReader()) | ||
p.Unlock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this panic if caching is disabled? Unlocking a not locked mutex, i believe, panics
Summary
This introduces automatic, time-based key rotation to the transit secrets engine. A new field is added to the
keysutil.Policy
that keeps track of an interval for key rotation. The value can be specified at key creation time or via a key config update. The value has a minimum of 1 hour and keys are checked for rotation about once an hour.Testing
There are three unit test suites included with this functionality:
TestTransit_CreateKeyWithAutorotation
inbuiltin/logical/transit/path_keys_test.go
which tests the creation of a key with the newauto_rotate_interval
request field.TestTransit_UpdateKeyConfigWithAutorotation
inbuiltin/logical/transit/path_config_test.go
which tests the update of an existing key with the newauto_rotate_interval
request field.TestTransit_AutoRotateKeys
inbuiltin/logical/transit/backend_test.go
which tests the actual automatic rotation of keys.