-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Nodes reload request store password as SecureString #31261
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
Merged
albertzaharovits
merged 7 commits into
elastic:reload-secure-store-action
from
albertzaharovits:secure-string-request
Jun 16, 2018
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9e71fa8
Secure String in Nodes reload request
albertzaharovits 0172407
Merge branch 'reload-secure-store-action' into secure-string-request
albertzaharovits 51675f8
Clear password on node action handler
albertzaharovits bccff0e
Encode and decode arrays
albertzaharovits 072bbbf
Clear last password
albertzaharovits 28a3305
Rename toUtf8Bytes -> charsToUtf8Bytes
albertzaharovits f67f1ae
Merge branch 'reload-secure-store-action' into secure-string-request
albertzaharovits File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,6 +32,7 @@ | |
| import org.elasticsearch.common.io.stream.StreamInput; | ||
| import org.elasticsearch.common.io.stream.StreamOutput; | ||
| import org.elasticsearch.common.settings.KeyStoreWrapper; | ||
| import org.elasticsearch.common.settings.SecureString; | ||
| import org.elasticsearch.common.settings.Settings; | ||
| import org.elasticsearch.env.Environment; | ||
| import org.elasticsearch.plugins.PluginsService; | ||
|
|
@@ -84,15 +85,15 @@ protected NodesReloadSecureSettingsResponse.NodeResponse newNodeResponse() { | |
| protected NodesReloadSecureSettingsResponse.NodeResponse nodeOperation(NodeRequest nodeReloadRequest) { | ||
| final NodesReloadSecureSettingsRequest request = nodeReloadRequest.request; | ||
| KeyStoreWrapper keystore = null; | ||
| try { | ||
| try (final SecureString secureSettingsPassword = request.secureSettingsPassword()) { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2/2 (1): The password is cleared on each |
||
| // reread keystore from config file | ||
| keystore = KeyStoreWrapper.load(environment.configFile()); | ||
| if (keystore == null) { | ||
| return new NodesReloadSecureSettingsResponse.NodeResponse(clusterService.localNode(), | ||
| new IllegalStateException("Keystore is missing")); | ||
| } | ||
| // decrypt the keystore using the password from the request | ||
| keystore.decrypt(request.secureSettingsPassword().toCharArray()); | ||
| keystore.decrypt(secureSettingsPassword.getChars()); | ||
| // add the keystore to the original node settings object | ||
| final Settings settingsWithKeystore = Settings.builder() | ||
| .put(environment.settings(), false) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
1/2: Since right now the keystore only uses the empty password, the previous implementation was sloppy and actually read the password as a REST parameter. This is terrible and has been corrected. It is now read from the request body.
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.
We're going to need to figure out a way to filter this in the security auditing. In x-pack we introduced the concept of a
RestRequestFilter. This concept might need to be promoted to core for this API.