Skip to content

Commit 5c1a1f7

Browse files
authored
Use PEM files for PkiOptionalClientAuthTests (#37683)
Use PEM files for the key/cert for TLS on the http layer of the node instead of a JKS keystore so that the tests can also run in a FIPS 140 JVM . Resolves: #37682
1 parent 3f27233 commit 5c1a1f7

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/pki/PkiOptionalClientAuthTests.java

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -49,27 +49,30 @@ protected Settings nodeSettings() {
4949
String randomClientPortRange = randomClientPort + "-" + (randomClientPort+100);
5050

5151
Settings.Builder builder = Settings.builder()
52-
.put(super.nodeSettings())
53-
.put("xpack.security.http.ssl.enabled", true)
54-
.put("xpack.security.http.ssl.client_authentication", SSLClientAuth.OPTIONAL)
55-
.put("xpack.security.http.ssl.keystore.path",
56-
getDataPath("/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.jks"))
57-
.put("xpack.security.http.ssl.keystore.password", "testnode")
58-
.put("xpack.security.authc.realms.file.file.order", "0")
59-
.put("xpack.security.authc.realms.pki.pki1.order", "1")
60-
.put("xpack.security.authc.realms.pki.pki1.truststore.path",
61-
getDataPath("/org/elasticsearch/xpack/security/transport/ssl/certs/simple/truststore-testnode-only.jks"))
62-
.put("xpack.security.authc.realms.pki.pki1.files.role_mapping", getDataPath("role_mapping.yml"))
63-
.put("transport.profiles.want_client_auth.port", randomClientPortRange)
64-
.put("transport.profiles.want_client_auth.bind_host", "localhost")
65-
.put("transport.profiles.want_client_auth.xpack.security.ssl.keystore.path",
66-
getDataPath("/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.jks"))
67-
.put("transport.profiles.want_client_auth.xpack.security.ssl.keystore.password", "testnode")
68-
.put("transport.profiles.want_client_auth.xpack.security.ssl.client_authentication", SSLClientAuth.OPTIONAL);
52+
.put(super.nodeSettings())
53+
.put("xpack.security.http.ssl.enabled", true)
54+
.put("xpack.security.http.ssl.client_authentication", SSLClientAuth.OPTIONAL)
55+
.put("xpack.security.http.ssl.key",
56+
getDataPath("/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.pem"))
57+
.put("xpack.security.http.ssl.certificate",
58+
getDataPath("/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.crt"))
59+
.put("xpack.security.authc.realms.file.file.order", "0")
60+
.put("xpack.security.authc.realms.pki.pki1.order", "1")
61+
.put("xpack.security.authc.realms.pki.pki1.truststore.path",
62+
getDataPath("/org/elasticsearch/xpack/security/transport/ssl/certs/simple/truststore-testnode-only.jks"))
63+
.put("xpack.security.authc.realms.pki.pki1.files.role_mapping", getDataPath("role_mapping.yml"))
64+
.put("transport.profiles.want_client_auth.port", randomClientPortRange)
65+
.put("transport.profiles.want_client_auth.bind_host", "localhost")
66+
.put("transport.profiles.want_client_auth.xpack.security.ssl.key",
67+
getDataPath("/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.pem"))
68+
.put("transport.profiles.want_client_auth.xpack.security.ssl.certificate",
69+
getDataPath("/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.crt"))
70+
.put("transport.profiles.want_client_auth.xpack.security.ssl.client_authentication", SSLClientAuth.OPTIONAL);
6971

7072
SecuritySettingsSource.addSecureSettings(builder, secureSettings -> {
7173
secureSettings.setString("xpack.security.authc.realms.pki.pki1.truststore.secure_password", "truststore-testnode-only");
72-
secureSettings.setString("xpack.security.http.ssl.keystore.secure_password", "testnode");
74+
secureSettings.setString("xpack.security.http.ssl.secure_key_passphrase", "testnode");
75+
secureSettings.setString("transport.profiles.want_client_auth.xpack.security.ssl.secure_key_passphrase", "testnode");
7376
});
7477
return builder.build();
7578

0 commit comments

Comments
 (0)