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

Add support for re-encrypting streams with new key #4296

Merged
merged 2 commits into from Jul 27, 2023
Merged

Conversation

neilalexander
Copy link
Member

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

@neilalexander neilalexander marked this pull request as ready for review July 13, 2023 09:10
@neilalexander neilalexander requested a review from a team as a code owner July 13, 2023 09:10
@neilalexander neilalexander force-pushed the neil/reencrypt branch 2 times, most recently from 04c6919 to 46321fd Compare July 14, 2023 11:30
Copy link
Member

@derekcollison derekcollison left a 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.

mb.bek.XORKeyStream(buf, buf)
if err := os.WriteFile(mb.mfn, buf, defaultFilePerms); err != nil {
return err
// Generate new keys based on our
Copy link
Member

Choose a reason for hiding this comment

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

Finish comment?

Copy link
Member Author

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":
Copy link
Member

Choose a reason for hiding this comment

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

prev_key

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@neilalexander neilalexander force-pushed the neil/reencrypt branch 2 times, most recently from c34824f to 5d58330 Compare July 25, 2023 15:58
Signed-off-by: Neil Twigg <neil@nats.io>
…ers at the same time as changing keys

Signed-off-by: Neil Twigg <neil@nats.io>
Copy link
Member

@Jarema Jarema left a 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.

@neilalexander neilalexander merged commit b22cdf1 into dev Jul 27, 2023
2 checks passed
@neilalexander neilalexander deleted the neil/reencrypt branch July 27, 2023 09:10
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.

None yet

3 participants