mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-14 17:05:36 +00:00
This change changes the way to run our test suites in JVMs configured in FIPS 140 approved mode. It does so by: - Configuring any given runtime Java in FIPS mode with the bundled policy and security properties files, setting the system properties java.security.properties and java.security.policy with the == operator that overrides the default JVM properties and policy. - When runtime java is 11 and higher, using BouncyCastle FIPS Cryptographic provider and BCJSSE in FIPS mode. These are used as testRuntime dependencies for unit tests and internal clusters, and copied (relevant jars) explicitly to the lib directory for testclusters used in REST tests - When runtime java is 8, using BouncyCastle FIPS Cryptographic provider and SunJSSE in FIPS mode. Running the tests in FIPS 140 approved mode doesn't require an additional configuration either in CI workers or locally and is controlled by specifying -Dtests.fips.enabled=true
40 lines
1.4 KiB
Groovy
40 lines
1.4 KiB
Groovy
import de.thetaphi.forbiddenapis.gradle.CheckForbiddenApis
|
|
import org.elasticsearch.gradle.info.BuildParams
|
|
|
|
apply plugin: 'elasticsearch.build'
|
|
|
|
archivesBaseName = 'elasticsearch-security-cli'
|
|
|
|
dependencies {
|
|
compileOnly project(":server")
|
|
compileOnly project(path: xpackModule('core'), configuration: 'default')
|
|
compile "org.bouncycastle:bcpkix-jdk15on:${versions.bouncycastle}"
|
|
compile "org.bouncycastle:bcprov-jdk15on:${versions.bouncycastle}"
|
|
testImplementation 'com.google.jimfs:jimfs:1.1'
|
|
testCompile project(":test:framework")
|
|
testCompile project(path: xpackModule('core'), configuration: 'testArtifacts')
|
|
}
|
|
|
|
dependencyLicenses {
|
|
mapping from: /bc.*/, to: 'bouncycastle'
|
|
}
|
|
|
|
forbiddenPatterns {
|
|
exclude '**/*.p12'
|
|
exclude '**/*.jks'
|
|
}
|
|
|
|
if (BuildParams.inFipsJvm) {
|
|
test.enabled = false
|
|
testingConventions.enabled = false
|
|
// Forbiden APIs non-portable checks fail because bouncy castle classes being used from the FIPS JDK since those are
|
|
// not part of the Java specification - all of this is as designed, so we have to relax this check for FIPS.
|
|
tasks.withType(CheckForbiddenApis) {
|
|
bundledSignatures -= "jdk-non-portable"
|
|
}
|
|
// FIPS JVM includes many classes from bouncycastle which count as jar hell for the third party audit,
|
|
// rather than provide a long list of exclusions, disable the check on FIPS.
|
|
thirdPartyAudit.enabled = false
|
|
|
|
}
|