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
Add support for re-encrypting streams with new key #4296
Conversation
04c6919
to
46321fd
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.
LGTM in general, few comments.
server/filestore.go
Outdated
mb.bek.XORKeyStream(buf, buf) | ||
if err := os.WriteFile(mb.mfn, buf, defaultFilePerms); err != nil { | ||
return err | ||
// Generate new keys based on our |
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.
Finish comment?
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.
Funnily enough this unfinished comment was there before, I'll update it.
server/opts.go
Outdated
@@ -2077,6 +2078,8 @@ func parseJetStream(v interface{}, opts *Options, errors *[]error, warnings *[]e | |||
doEnable = mv.(bool) | |||
case "key", "ek", "encryption_key": | |||
opts.JetStreamKey = mv.(string) | |||
case "old_key", "old_ek", "old_encryption_key": |
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.
prev_key
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.
Done
c34824f
to
5d58330
Compare
Signed-off-by: Neil Twigg <neil@nats.io>
…ers at the same time as changing keys Signed-off-by: Neil Twigg <neil@nats.io>
5d58330
to
bc78e86
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.
As Neil addressed all comments, LGTM.
This adds a new
old_key
field to the configuration file to allow transitioning from one encryption key to another.Signed-off-by: Neil Twigg neil@nats.io