Skip to content

Commit 8d5be89

Browse files
committed
Enable QA tests to run with FIPS nodes (#40105)
This commit enables full-cluster-restart and rolling-upgrade tests to run with nodes using a JVM in fips approved only node by using PEM key material instead of a JKS for the transport layer in that case.
1 parent 9bee554 commit 8d5be89

File tree

2 files changed

+54
-20
lines changed

2 files changed

+54
-20
lines changed

x-pack/qa/full-cluster-restart/build.gradle

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,10 @@ subprojects {
132132
}
133133

134134
String output = "${buildDir}/generated-resources/${project.name}"
135-
task copyTestNodeKeystore(type: Copy) {
136-
from project(':x-pack:plugin:core')
137-
.file('src/test/resources/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.jks')
135+
task copyTestNodeKeyMaterial(type: Copy) {
136+
from project(':x-pack:plugin:core').files('src/test/resources/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.pem',
137+
'src/test/resources/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.crt',
138+
'src/test/resources/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.jks')
138139
into outputDir
139140
}
140141

@@ -152,7 +153,7 @@ subprojects {
152153

153154
Object extension = extensions.findByName("${baseName}#oldClusterTestCluster")
154155
configure(extensions.findByName("${baseName}#oldClusterTestCluster")) {
155-
dependsOn copyTestNodeKeystore
156+
dependsOn copyTestNodeKeyMaterial
156157
if (version.before('6.3.0')) {
157158
String depVersion = version;
158159
if (project.bwcVersions.unreleased.contains(version)) {
@@ -174,12 +175,20 @@ subprojects {
174175

175176
setting 'xpack.security.enabled', 'true'
176177
setting 'xpack.security.transport.ssl.enabled', version.onOrAfter("5.2.0").toString()
177-
setting 'xpack.ssl.keystore.path', 'testnode.jks'
178-
setting 'xpack.ssl.keystore.password', 'testnode'
178+
if (project.inFipsJvm && version.onOrAfter('6.4.0')) {
179+
setting 'xpack.ssl.key', 'testnode.pem'
180+
setting 'xpack.ssl.certificate', 'testnode.crt'
181+
keystoreSetting 'xpack.ssl.secure_key_passphrase', 'testnode'
182+
} else {
183+
setting 'xpack.ssl.keystore.path', 'testnode.jks'
184+
setting 'xpack.ssl.keystore.password', 'testnode'
185+
}
179186
if (version.onOrAfter('6.3.0')) {
180187
setting 'xpack.license.self_generated.type', 'trial'
181188
}
182-
dependsOn copyTestNodeKeystore
189+
dependsOn copyTestNodeKeyMaterial
190+
extraConfigFile 'testnode.pem', new File(outputDir + '/testnode.pem')
191+
extraConfigFile 'testnode.crt', new File(outputDir + '/testnode.crt')
183192
extraConfigFile 'testnode.jks', new File(outputDir + '/testnode.jks')
184193
if (version.before('5.1.2')) {
185194
// Disable monitoring if version is before 5.1.2 because form 5.1.2 we changed how we get DocStats
@@ -226,11 +235,19 @@ subprojects {
226235
// some tests rely on the translog not being flushed
227236
setting 'indices.memory.shard_inactive_time', '20m'
228237
setting 'xpack.security.enabled', 'true'
229-
setting 'xpack.ssl.keystore.path', 'testnode.jks'
230-
keystoreSetting 'xpack.ssl.keystore.secure_password', 'testnode'
238+
if (project.inFipsJvm) {
239+
setting 'xpack.ssl.key', 'testnode.pem'
240+
setting 'xpack.ssl.certificate', 'testnode.crt'
241+
keystoreSetting 'xpack.ssl.secure_key_passphrase', 'testnode'
242+
} else {
243+
setting 'xpack.ssl.keystore.path', 'testnode.jks'
244+
keystoreSetting 'xpack.ssl.keystore.secure_password', 'testnode'
245+
}
231246
setting 'xpack.license.self_generated.type', 'trial'
232-
dependsOn copyTestNodeKeystore
247+
dependsOn copyTestNodeKeyMaterial
233248
extraConfigFile 'testnode.jks', new File(outputDir + '/testnode.jks')
249+
extraConfigFile 'testnode.pem', new File(outputDir + '/testnode.pem')
250+
extraConfigFile 'testnode.crt', new File(outputDir + '/testnode.crt')
234251
if (withSystemKey) {
235252
setting 'xpack.watcher.encrypt_sensitive_data', 'true'
236253
keystoreFile 'xpack.watcher.encryption_key', "${mainProject.projectDir}/src/test/resources/system_key"

x-pack/qa/rolling-upgrade/build.gradle

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,10 @@ subprojects {
111111
}
112112

113113
String output = "${buildDir}/generated-resources/${project.name}"
114-
task copyTestNodeKeystore(type: Copy) {
115-
from project(':x-pack:plugin:core')
116-
.file('src/test/resources/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.jks')
114+
task copyTestNodeKeyMaterial(type: Copy) {
115+
from project(':x-pack:plugin:core').files('src/test/resources/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.pem',
116+
'src/test/resources/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.crt',
117+
'src/test/resources/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.jks')
117118
into outputDir
118119
}
119120

@@ -125,7 +126,7 @@ subprojects {
125126
}
126127

127128
configure(extensions.findByName("${baseName}#oldClusterTestCluster")) {
128-
dependsOn copyTestNodeKeystore
129+
dependsOn copyTestNodeKeyMaterial
129130
if (version.before('6.3.0')) {
130131
String depVersion = version;
131132
if (project.bwcVersions.unreleased.contains(version)) {
@@ -152,15 +153,23 @@ subprojects {
152153
setting 'xpack.security.authc.token.enabled', 'true'
153154
setting 'xpack.security.audit.enabled', 'true'
154155
setting 'xpack.security.audit.outputs', 'index'
155-
setting 'xpack.ssl.keystore.path', 'testnode.jks'
156-
setting 'xpack.ssl.keystore.password', 'testnode'
156+
if (project.inFipsJvm && version.onOrAfter('6.4.0')) {
157+
setting 'xpack.ssl.key', 'testnode.pem'
158+
setting 'xpack.ssl.certificate', 'testnode.crt'
159+
keystoreSetting 'xpack.ssl.secure_key_passphrase', 'testnode'
160+
} else {
161+
setting 'xpack.ssl.keystore.path', 'testnode.jks'
162+
setting 'xpack.ssl.keystore.password', 'testnode'
163+
}
157164
setting 'logger.org.elasticsearch.xpack.security.audit.index', 'DEBUG'
158165
if (version.onOrAfter('6.0.0') == false) {
159166
// this is needed since in 5.6 we don't bootstrap the token service if there is no explicit initial password
160167
keystoreSetting 'xpack.security.authc.token.passphrase', 'xpack_token_passphrase'
161168
}
162-
dependsOn copyTestNodeKeystore
169+
dependsOn copyTestNodeKeyMaterial
163170
extraConfigFile 'testnode.jks', new File(outputDir + '/testnode.jks')
171+
extraConfigFile 'testnode.pem', new File(outputDir + '/testnode.pem')
172+
extraConfigFile 'testnode.crt', new File(outputDir + '/testnode.crt')
164173
if (withSystemKey) {
165174
if (version.onOrAfter('5.1.0') && version.before('6.0.0')) {
166175
// The setting didn't exist until 5.1.0
@@ -210,8 +219,14 @@ subprojects {
210219
setting 'xpack.license.self_generated.type', 'trial'
211220
setting 'xpack.security.enabled', 'true'
212221
setting 'xpack.security.transport.ssl.enabled', 'true'
213-
setting 'xpack.ssl.keystore.path', 'testnode.jks'
214-
keystoreSetting 'xpack.ssl.keystore.secure_password', 'testnode'
222+
if (project.inFipsJvm) {
223+
setting 'xpack.ssl.key', 'testnode.pem'
224+
setting 'xpack.ssl.certificate', 'testnode.crt'
225+
keystoreSetting 'xpack.ssl.secure_key_passphrase', 'testnode'
226+
} else {
227+
setting 'xpack.ssl.keystore.path', 'testnode.jks'
228+
keystoreSetting 'xpack.ssl.keystore.secure_password', 'testnode'
229+
}
215230
setting 'logger.org.elasticsearch.xpack.security.audit.index', 'DEBUG'
216231
if (version.onOrAfter('6.0.0') == false) {
217232
// this is needed since in 5.6 we don't bootstrap the token service if there is no explicit initial password
@@ -223,8 +238,10 @@ subprojects {
223238
setting 'xpack.security.audit.enabled', 'true'
224239
setting 'xpack.security.audit.outputs', 'index'
225240
setting 'node.name', "upgraded-node-${stopNode}"
226-
dependsOn copyTestNodeKeystore
241+
dependsOn copyTestNodeKeyMaterial
227242
extraConfigFile 'testnode.jks', new File(outputDir + '/testnode.jks')
243+
extraConfigFile 'testnode.pem', new File(outputDir + '/testnode.pem')
244+
extraConfigFile 'testnode.crt', new File(outputDir + '/testnode.crt')
228245
if (withSystemKey) {
229246
setting 'xpack.watcher.encrypt_sensitive_data', 'true'
230247
keystoreFile 'xpack.watcher.encryption_key', "${mainProject.projectDir}/src/test/resources/system_key"

0 commit comments

Comments
 (0)