@@ -104,39 +104,28 @@ integTestRunner {
104
104
systemProperty ' tests.rest.blacklist' , blacklist. join(' ,' )
105
105
}
106
106
107
- // location of generated keystores and certificates
107
+ // location for keys and certificates
108
108
File keystoreDir = new File (project. buildDir, ' keystore' )
109
-
110
- // Generate the node's keystore
111
- File nodeKeystore = new File (keystoreDir, ' test-node.jks' )
112
- task createNodeKeyStore (type : LoggedExec ) {
113
- doFirst {
114
- if (nodeKeystore. parentFile. exists() == false ) {
115
- nodeKeystore. parentFile. mkdirs()
116
- }
117
- if (nodeKeystore. exists()) {
118
- delete nodeKeystore
109
+ File nodeKey = file(" $keystoreDir /testnode.pem" )
110
+ File nodeCert = file(" $keystoreDir /testnode.crt" )
111
+
112
+ // Add key and certs to test classpath: it expects them there
113
+ // User cert and key PEM files instead of a JKS Keystore for the cluster's trust material so that
114
+ // it can run in a FIPS 140 JVM
115
+ // TODO: Remove all existing uses of cross project file references when the new approach for referencing static files is available
116
+ // https://github.com/elastic/elasticsearch/pull/32201
117
+ task copyKeyCerts (type : Copy ) {
118
+ from(project(' :x-pack:plugin:core' ). file(' src/test/resources/org/elasticsearch/xpack/security/transport/ssl/certs/simple/' )) {
119
+ include ' testnode.crt' , ' testnode.pem'
119
120
}
120
- }
121
- executable = new File (project. runtimeJavaHome, ' bin/keytool' )
122
- standardInput = new ByteArrayInputStream (' FirstName LastName\n Unit\n Organization\n City\n State\n NL\n yes\n\n ' . getBytes(' UTF-8' ))
123
- args ' -genkey' ,
124
- ' -alias' , ' test-node' ,
125
- ' -keystore' , nodeKeystore,
126
- ' -keyalg' , ' RSA' ,
127
- ' -keysize' , ' 2048' ,
128
- ' -validity' , ' 712' ,
129
- ' -dname' , ' CN=smoke-test-plugins-ssl' ,
130
- ' -keypass' , ' keypass' ,
131
- ' -storepass' , ' keypass'
121
+ into keystoreDir
132
122
}
133
-
134
123
// Add keystores to test classpath: it expects it there
135
124
sourceSets. test. resources. srcDir(keystoreDir)
136
- processTestResources. dependsOn(createNodeKeyStore )
125
+ processTestResources. dependsOn(copyKeyCerts )
137
126
138
127
integTestCluster {
139
- dependsOn createNodeKeyStore
128
+ dependsOn copyKeyCerts
140
129
setting ' xpack.ml.enabled' , ' true'
141
130
setting ' xpack.security.enabled' , ' true'
142
131
setting ' logger.org.elasticsearch.xpack.ml.datafeed' , ' TRACE'
@@ -145,17 +134,19 @@ integTestCluster {
145
134
setting ' xpack.monitoring.exporters._local.enabled' , ' false'
146
135
setting ' xpack.security.authc.token.enabled' , ' true'
147
136
setting ' xpack.security.transport.ssl.enabled' , ' true'
148
- setting ' xpack.security.transport.ssl.keystore.path' , nodeKeystore. name
137
+ setting ' xpack.security.transport.ssl.key' , nodeKey. name
138
+ setting ' xpack.security.transport.ssl.certificate' , nodeCert. name
149
139
setting ' xpack.security.transport.ssl.verification_mode' , ' certificate'
150
140
setting ' xpack.security.audit.enabled' , ' true'
151
141
setting ' xpack.license.self_generated.type' , ' trial'
152
142
keystoreSetting ' bootstrap.password' , ' x-pack-test-password'
153
- keystoreSetting ' xpack.security.transport.ssl.keystore.secure_password ' , ' keypass '
143
+ keystoreSetting ' xpack.security.transport.ssl.secure_key_passphrase ' , ' testnode '
154
144
distribution = ' zip' // this is important since we use the reindex module in ML
155
145
156
146
setupCommand ' setupTestUser' , ' bin/elasticsearch-users' , ' useradd' , ' x_pack_rest_user' , ' -p' , ' x-pack-test-password' , ' -r' , ' superuser'
157
147
158
- extraConfigFile nodeKeystore. name, nodeKeystore
148
+ extraConfigFile nodeKey. name, nodeKey
149
+ extraConfigFile nodeCert. name, nodeCert
159
150
160
151
waitCondition = { NodeInfo node , AntBuilder ant ->
161
152
File tmpFile = new File (node. cwd, ' wait.success' )
0 commit comments