|
| 1 | +import org.elasticsearch.gradle.info.BuildParams |
1 | 2 | import org.elasticsearch.gradle.test.RestIntegTestTask
|
2 | 3 |
|
3 | 4 | apply plugin: 'elasticsearch.testclusters'
|
@@ -26,21 +27,47 @@ task writeJavaPolicy {
|
26 | 27 | if (policyFile.parentFile.exists() == false && policyFile.parentFile.mkdirs() == false) {
|
27 | 28 | throw new GradleException("failed to create temporary directory [${tmp}]")
|
28 | 29 | }
|
29 |
| - policyFile.write( |
30 |
| - [ |
31 |
| - "grant {", |
32 |
| - " permission java.io.FilePermission \"${-> testClusters."follow-cluster".getFirstNode().getServerLog()}\", \"read\";", |
33 |
| - "};" |
34 |
| - ].join("\n") |
35 |
| - ) |
| 30 | + if (BuildParams.inFipsJvm) { |
| 31 | + policyFile.write( |
| 32 | + [ |
| 33 | + "grant {", |
| 34 | + "permission java.security.SecurityPermission \"putProviderProperty.BCFIPS\";", |
| 35 | + "permission java.security.SecurityPermission \"putProviderProperty.BCJSSE\";", |
| 36 | + "permission java.lang.RuntimePermission \"getProtectionDomain\";", |
| 37 | + "permission java.util.PropertyPermission \"java.runtime.name\", \"read\";", |
| 38 | + "permission org.bouncycastle.crypto.CryptoServicesPermission \"tlsAlgorithmsEnabled\";", |
| 39 | + "permission java.lang.RuntimePermission \"accessClassInPackage.sun.security.internal.spec\";", |
| 40 | + "permission java.lang.RuntimePermission \"accessDeclaredMembers\";", |
| 41 | + "permission java.util.PropertyPermission \"intellij.debug.agent\", \"read\";", |
| 42 | + "permission java.util.PropertyPermission \"intellij.debug.agent\", \"write\";", |
| 43 | + "permission org.bouncycastle.crypto.CryptoServicesPermission \"exportSecretKey\";", |
| 44 | + "permission org.bouncycastle.crypto.CryptoServicesPermission \"exportPrivateKey\";", |
| 45 | + "permission java.io.FilePermission \"\${javax.net.ssl.trustStore}\", \"read\";", |
| 46 | + "permission java.io.FilePermission \"${-> testClusters."follow-cluster".getFirstNode().getServerLog()}\", \"read\";", |
| 47 | + "};" |
| 48 | + ].join("\n") |
| 49 | + ) |
| 50 | + } else { |
| 51 | + policyFile.write( |
| 52 | + [ |
| 53 | + "grant {", |
| 54 | + " permission java.io.FilePermission \"${-> testClusters."follow-cluster".getFirstNode().getServerLog()}\", \"read\";", |
| 55 | + "};" |
| 56 | + ].join("\n") |
| 57 | + ) |
| 58 | + } |
36 | 59 | }
|
37 | 60 | }
|
38 | 61 |
|
39 | 62 | task "follow-cluster"(type: RestIntegTestTask) {
|
40 | 63 | dependsOn 'writeJavaPolicy', "leader-cluster"
|
41 | 64 | runner {
|
42 | 65 | useCluster testClusters."leader-cluster"
|
43 |
| - systemProperty 'java.security.policy', "file://${policyFile}" |
| 66 | + if (BuildParams.inFipsJvm){ |
| 67 | + systemProperty 'java.security.policy', "=file://${policyFile}" |
| 68 | + } else { |
| 69 | + systemProperty 'java.security.policy', "file://${policyFile}" |
| 70 | + } |
44 | 71 | systemProperty 'tests.target_cluster', 'follow'
|
45 | 72 | nonInputProperties.systemProperty 'tests.leader_host', "${-> testClusters."leader-cluster".getAllHttpSocketURI().get(0)}"
|
46 | 73 | nonInputProperties.systemProperty 'log', "${-> testClusters."follow-cluster".getFirstNode().getServerLog()}"
|
|
0 commit comments