Skip to content

Commit

Permalink
Do not clear keystore password on node requests
Browse files Browse the repository at this point in the history
  • Loading branch information
albertzaharovits committed Jun 17, 2018
1 parent e27f097 commit 56f741e
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,9 @@ protected NodesReloadSecureSettingsResponse.NodeResponse newNodeResponse() {
@Override
protected NodesReloadSecureSettingsResponse.NodeResponse nodeOperation(NodeRequest nodeReloadRequest) {
final NodesReloadSecureSettingsRequest request = nodeReloadRequest.request;
KeyStoreWrapper keystore = null;
try (SecureString secureSettingsPassword = request.secureSettingsPassword()) {
final SecureString secureSettingsPassword = request.secureSettingsPassword();
try (KeyStoreWrapper keystore = KeyStoreWrapper.load(environment.configFile())) {
// reread keystore from config file
keystore = KeyStoreWrapper.load(environment.configFile());
if (keystore == null) {
return new NodesReloadSecureSettingsResponse.NodeResponse(clusterService.localNode(),
new IllegalStateException("Keystore is missing"));
Expand All @@ -114,10 +113,6 @@ protected NodesReloadSecureSettingsResponse.NodeResponse nodeOperation(NodeReque
return new NodesReloadSecureSettingsResponse.NodeResponse(clusterService.localNode(), null);
} catch (final Exception e) {
return new NodesReloadSecureSettingsResponse.NodeResponse(clusterService.localNode(), e);
} finally {
if (keystore != null) {
keystore.close();
}
}
}

Expand Down

0 comments on commit 56f741e

Please sign in to comment.