Skip to content

Commit

Permalink
Use PEM files instead of a JKS for key material
Browse files Browse the repository at this point in the history
So that the tests can also run in a FIPS 140 JVM, where using a
JKS keystore is not allowed.

Resolves: elastic#49261
  • Loading branch information
jkakavas committed Nov 27, 2019
1 parent 4013e81 commit eefada0
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -508,16 +508,19 @@ void reloadSSLContext(SSLConfiguration configuration) {
}

private Settings.Builder baseKeystoreSettings(Path tempDir, MockSecureSettings secureSettings) throws IOException {
final Path keystorePath = tempDir.resolve("testclient.jks");
Files.copy(getDataPath("/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.jks"), keystorePath);
final Path keyPath = tempDir.resolve("testclient.pem");
final Path certPath = tempDir.resolve("testclient.crt");
Files.copy(getDataPath("/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.pem"), keyPath);
Files.copy(getDataPath("/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.crt"), certPath);

if (secureSettings == null) {
secureSettings = new MockSecureSettings();
}
secureSettings.setString("xpack.security.transport.ssl.keystore.secure_password", "testnode");
secureSettings.setString("xpack.security.transport.ssl.secure_key_passphrase", "testnode");

return Settings.builder()
.put("xpack.security.transport.ssl.keystore.path", keystorePath.toString())
.put("xpack.security.transport.ssl.key", keyPath.toString())
.put("xpack.security.transport.ssl.certificate", certPath.toString())
.setSecureSettings(secureSettings);
}

Expand Down

0 comments on commit eefada0

Please sign in to comment.