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

Don't duplicate user-provided Enterprise Search encryption keys when reusing them #4052

Merged
merged 2 commits into from
Dec 21, 2020

Conversation

sebgl
Copy link
Contributor

@sebgl sebgl commented Dec 17, 2020

This commit fixes a bug in the operator when users provide their own
encryption keys.

When we retrieved existing encryption keys (to ensure we don't generate a new
one), we retrieved all of them including user-provided ones.
We then merge the user-provided configuration, which also includes user-provided
encryption keys. So everytime we reconcile the configuration, we duplicate
the user-provided encryption keys into the reconciled config secret. Because this
secret changes, all Pods get rotated automatically.
This results in a never-ending config update (growing forever) and pod rotation.

This commit fixes it by ensuring the operator always manages the first encryption key.
This first key is the only one that gets reused. User-provided keys are then appended
to the list of keys.

This allows the following use case:

  • deploy ent search with no encryption key: you get a generated one
  • add your own custom encryption keys: it is appended to the array after
    the generated one. Transition is smooth. If we were to replace the generated
    one in that case, Enterprise Search would not be able to decrypt data.

Fixes #4051.

This commit fixes a bug in the operator when users provide their own
encryption keys.

When we retrieved existing encryption keys (to ensure we don't generate a new
one), we retrieved *all of them* including user-provided ones.
We then merge the user-provided configuration, which also includes user-provided
encryption keys. So everytime we reconcile the configuration, we duplicate
the user-provided encryption keys into the reconciled config secret. Because this
secret changes, all Pods get rotated automatically.
This results in a never-ending config update (growing forever) and pod rotation.

This commit fixes it by ensuring the operator always manages the first encryption key.
This first key is the only one that gets reused. User-provided keys are then appended
to the list of keys.

This allows the following use case:
- deploy ent search with no encryption key: you get a generated one
- add your own custom encryption keys: it is appended to the array after
the generated one. Transition is smooth. If we were to replace the generated
one in that case, Enterprise Search would not be able to decrypt data.
Copy link
Collaborator

@pebrc pebrc left a comment

Choose a reason for hiding this comment

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

LGTM

pkg/controller/enterprisesearch/config.go Show resolved Hide resolved
@sebgl sebgl merged commit 34f8a7c into elastic:master Dec 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug Something isn't working v1.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enterprise search revision slam when custom encryption key provided
2 participants