|
24 | 24 | import org.elasticsearch.action.admin.cluster.node.reload.NodesReloadSecureSettingsResponse; |
25 | 25 | import org.elasticsearch.common.settings.KeyStoreWrapper; |
26 | 26 | import org.elasticsearch.common.settings.SecureSettings; |
| 27 | +import org.elasticsearch.common.settings.SecureString; |
27 | 28 | import org.elasticsearch.common.settings.Settings; |
28 | 29 | import org.elasticsearch.env.Environment; |
29 | 30 | import org.elasticsearch.plugins.Plugin; |
@@ -62,7 +63,7 @@ public void testMissingKeystoreFile() throws Exception { |
62 | 63 | Files.deleteIfExists(KeyStoreWrapper.keystorePath(environment.configFile())); |
63 | 64 | final int initialReloadCount = mockReloadablePlugin.getReloadCount(); |
64 | 65 | final CountDownLatch latch = new CountDownLatch(1); |
65 | | - client().admin().cluster().prepareReloadSecureSettings().setSecureStorePassword("").execute( |
| 66 | + client().admin().cluster().prepareReloadSecureSettings().setSecureStorePassword(new SecureString(new char[0])).execute( |
66 | 67 | new ActionListener<NodesReloadSecureSettingsResponse>() { |
67 | 68 | @Override |
68 | 69 | public void onResponse(NodesReloadSecureSettingsResponse nodesReloadResponse) { |
@@ -149,7 +150,7 @@ public void testInvalidKeystoreFile() throws Exception { |
149 | 150 | Files.copy(keystore, KeyStoreWrapper.keystorePath(environment.configFile()), StandardCopyOption.REPLACE_EXISTING); |
150 | 151 | } |
151 | 152 | final CountDownLatch latch = new CountDownLatch(1); |
152 | | - client().admin().cluster().prepareReloadSecureSettings().setSecureStorePassword("").execute( |
| 153 | + client().admin().cluster().prepareReloadSecureSettings().setSecureStorePassword(new SecureString(new char[0])).execute( |
153 | 154 | new ActionListener<NodesReloadSecureSettingsResponse>() { |
154 | 155 | @Override |
155 | 156 | public void onResponse(NodesReloadSecureSettingsResponse nodesReloadResponse) { |
@@ -191,8 +192,11 @@ public void testWrongKeystorePassword() throws Exception { |
191 | 192 | // "some" keystore should be present in this case |
192 | 193 | writeEmptyKeystore(environment, new char[0]); |
193 | 194 | final CountDownLatch latch = new CountDownLatch(1); |
194 | | - client().admin().cluster().prepareReloadSecureSettings().setSecureStorePassword("Wrong password here").execute( |
195 | | - new ActionListener<NodesReloadSecureSettingsResponse>() { |
| 195 | + client().admin() |
| 196 | + .cluster() |
| 197 | + .prepareReloadSecureSettings() |
| 198 | + .setSecureStorePassword(new SecureString(new char[] { 'W', 'r', 'o', 'n', 'g' })) |
| 199 | + .execute(new ActionListener<NodesReloadSecureSettingsResponse>() { |
196 | 200 | @Override |
197 | 201 | public void onResponse(NodesReloadSecureSettingsResponse nodesReloadResponse) { |
198 | 202 | try { |
@@ -244,7 +248,7 @@ public void testMisbehavingPlugin() throws Exception { |
244 | 248 | .get(Settings.builder().put(environment.settings()).setSecureSettings(secureSettings).build()) |
245 | 249 | .toString(); |
246 | 250 | final CountDownLatch latch = new CountDownLatch(1); |
247 | | - client().admin().cluster().prepareReloadSecureSettings().setSecureStorePassword("").execute( |
| 251 | + client().admin().cluster().prepareReloadSecureSettings().setSecureStorePassword(new SecureString(new char[0])).execute( |
248 | 252 | new ActionListener<NodesReloadSecureSettingsResponse>() { |
249 | 253 | @Override |
250 | 254 | public void onResponse(NodesReloadSecureSettingsResponse nodesReloadResponse) { |
@@ -311,7 +315,7 @@ protected Collection<Class<? extends Plugin>> nodePlugins() { |
311 | 315 | private void successfulReloadCall() throws InterruptedException { |
312 | 316 | final AtomicReference<AssertionError> reloadSettingsError = new AtomicReference<>(); |
313 | 317 | final CountDownLatch latch = new CountDownLatch(1); |
314 | | - client().admin().cluster().prepareReloadSecureSettings().setSecureStorePassword("").execute( |
| 318 | + client().admin().cluster().prepareReloadSecureSettings().setSecureStorePassword(new SecureString(new char[0])).execute( |
315 | 319 | new ActionListener<NodesReloadSecureSettingsResponse>() { |
316 | 320 | @Override |
317 | 321 | public void onResponse(NodesReloadSecureSettingsResponse nodesReloadResponse) { |
|
0 commit comments