Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
7a352cd
Bump io.grpc:grpc-context from 1.56.1 to 1.57.1 in /plugins/repositor…
cwperks Aug 7, 2023
22bf841
Update CHANGELOG
cwperks Aug 7, 2023
04c9e1e
Remove paren
cwperks Aug 7, 2023
128fb79
Draft to allow run in FIPS compliace mode
iigonin Mar 4, 2024
2c6e14b
make tests run without BC (not BCFIPS) libraries.
iigonin Aug 7, 2024
30c0b32
disable approved-only mode for launch configuration of testcluster
iigonin Aug 8, 2024
0ef725d
update all BC libraries to support JAVA 21
iigonin Aug 8, 2024
a33a10f
try to pass bwc staged build by adding expected version
iigonin Aug 8, 2024
54e31be
ensure FIPS-mode can be enabled by fixing existent and creating addit…
iigonin Aug 30, 2024
32586d4
fixing additional tests.
iigonin Sep 23, 2024
24510e7
Configure FIPS mode through global ENV VAR instead of thread-based.
iigonin Oct 18, 2024
5562d1f
write some additional unit tests.
iigonin Oct 24, 2024
71ef8d9
test SystemJvmOptions.java & replace FIPS-140-2 by FIPS-140-3
iigonin Oct 28, 2024
4832553
categorize JKS keystore as untrusted
iigonin Nov 8, 2024
183891d
general exclusion of keystore binaries and certificates from fobidden…
iigonin Nov 14, 2024
5cc787d
Kerberos, forbiddenApis, SecureRandom, SunJCE, AzureTests
iigonin Nov 19, 2024
fe86126
remove BC libs from 'libs:common'; revert SecureRandomHolder
iigonin Jan 9, 2025
945ec7d
loosen some direct BC dependencies
iigonin Jan 16, 2025
cfa5d79
set default testcluster password for all project modules
iigonin Jan 27, 2025
b609772
build with 'crypto.standard' gradle build parameter
iigonin Jan 31, 2025
f88d5a5
run REST-tests with JKS & BCFKS keystores
iigonin Feb 4, 2025
5c97dd6
Explicitly call closeConnectionChannel
cwperks Feb 12, 2025
c583753
Run on fork
cwperks Feb 12, 2025
2ebf326
Remove if
cwperks Feb 12, 2025
e2d4105
Revert "Remove if"
cwperks Feb 12, 2025
0d1273a
Revert "Run on fork"
cwperks Feb 12, 2025
497e6a2
Revert "Remove paren"
cwperks Feb 12, 2025
ec7a874
Revert "Update CHANGELOG"
cwperks Feb 12, 2025
f2ef96e
Revert "Bump io.grpc:grpc-context from 1.56.1 to 1.57.1 in /plugins/r…
cwperks Feb 12, 2025
5eed625
Merge branch 'main' into bump-grpc
cwperks Feb 12, 2025
ef6685f
Merge branch 'fips_compliance2' into bump-grpc
cwperks Feb 12, 2025
c86e827
Explicitly close and allow 5s linger
cwperks Feb 12, 2025
4548fc9
Explicitly close connection
cwperks Feb 12, 2025
5ff2232
Merge branch 'main' into bump-grpc
cwperks Feb 12, 2025
10d8a81
Revert "Explicitly close connection"
cwperks Feb 12, 2025
0b1601c
Revert "Explicitly close and allow 5s linger"
cwperks Feb 12, 2025
d96f070
Add debug statement
cwperks Feb 13, 2025
e965361
Increase timeout to 25
cwperks Feb 13, 2025
830a92b
Explicitly close TS_C and TS_D
cwperks Feb 13, 2025
7b9e44a
Merge branch 'main' into bump-grpc
cwperks Feb 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG-3.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Views, simplify data access and manipulation by providing a virtual layer over one or more indices ([#11957](https://github.com/opensearch-project/OpenSearch/pull/11957))
- Added pull-based Ingestion (APIs, for ingestion source, a Kafka plugin, and IngestionEngine that pulls data from the ingestion source) ([#16958](https://github.com/opensearch-project/OpenSearch/pull/16958))
- Added ConfigurationUtils to core for the ease of configuration parsing [#17223](https://github.com/opensearch-project/OpenSearch/pull/17223)
- Support for FIPS-140-3 compliance through environment variable ([#3420](https://github.com/opensearch-project/OpenSearch/pull/14912))

### Dependencies
- Update Apache Lucene to 10.1.0 ([#16366](https://github.com/opensearch-project/OpenSearch/pull/16366))
Expand Down
19 changes: 17 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ apply from: 'gradle/ide.gradle'
apply from: 'gradle/forbidden-dependencies.gradle'
apply from: 'gradle/formatting.gradle'
apply from: 'gradle/local-distribution.gradle'
apply from: 'gradle/fips.gradle'
apply from: 'gradle/run.gradle'
apply from: 'gradle/missing-javadoc.gradle'
apply from: 'gradle/code-coverage.gradle'
Expand Down Expand Up @@ -472,8 +471,8 @@ gradle.projectsEvaluated {
}
}

// test retry configuration
subprojects {
// test retry configuration
tasks.withType(Test).configureEach {
develocity.testRetry {
if (BuildParams.isCi()) {
Expand Down Expand Up @@ -559,6 +558,22 @@ subprojects {
}
}
}

// test with FIPS-140-3 enabled
plugins.withType(JavaPlugin).configureEach {
tasks.withType(Test).configureEach { testTask ->
if (BuildParams.inFipsJvm) {
testTask.jvmArgs += "-Dorg.bouncycastle.fips.approved_only=true"
}
}
}
plugins.withId('opensearch.testclusters') {
testClusters.configureEach {
if (BuildParams.inFipsJvm) {
keystorePassword 'notarealpasswordphrase'
}
}
}
}

// eclipse configuration
Expand Down
4 changes: 0 additions & 4 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,8 @@ if (project != rootProject) {

forbiddenPatterns {
exclude '**/*.wav'
exclude '**/*.p12'
exclude '**/*.jks'
exclude '**/*.crt'
// the file that actually defines nocommit
exclude '**/ForbiddenPatternsTask.java'
exclude '**/*.bcfks'
}

testingConventions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@
test.systemProperty("tests.seed", BuildParams.getTestSeed());
}

var securityFile = BuildParams.isInFipsJvm() ? "fips_java.security" : "java.security";
test.systemProperty(

Check warning on line 168 in buildSrc/src/main/java/org/opensearch/gradle/OpenSearchTestBasePlugin.java

View check run for this annotation

Codecov / codecov/patch

buildSrc/src/main/java/org/opensearch/gradle/OpenSearchTestBasePlugin.java#L168

Added line #L168 was not covered by tests
"java.security.properties",
project.getRootProject().getLayout().getProjectDirectory() + "/distribution/src/config/" + securityFile

Check warning on line 170 in buildSrc/src/main/java/org/opensearch/gradle/OpenSearchTestBasePlugin.java

View check run for this annotation

Codecov / codecov/patch

buildSrc/src/main/java/org/opensearch/gradle/OpenSearchTestBasePlugin.java#L170

Added line #L170 was not covered by tests
);

// don't track these as inputs since they contain absolute paths and break cache relocatability
File gradleHome = project.getGradle().getGradleUserHomeDir();
String gradleVersion = project.getGradle().getGradleVersion();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@

package org.opensearch.gradle.http;

import de.thetaphi.forbiddenapis.SuppressForbidden;

import org.gradle.api.logging.Logger;
import org.gradle.api.logging.Logging;

Expand Down Expand Up @@ -216,15 +218,15 @@ KeyStore buildTrustStore() throws GeneralSecurityException, IOException {
}

private KeyStore buildTrustStoreFromFile() throws GeneralSecurityException, IOException {
KeyStore keyStore = KeyStore.getInstance(trustStoreFile.getName().endsWith(".jks") ? "JKS" : "PKCS12");
var keyStore = getKeyStoreInstance(trustStoreFile.getName().endsWith(".jks") ? "JKS" : "PKCS12");
try (InputStream input = new FileInputStream(trustStoreFile)) {
keyStore.load(input, trustStorePassword == null ? null : trustStorePassword.toCharArray());
}
return keyStore;
}

private KeyStore buildTrustStoreFromCA() throws GeneralSecurityException, IOException {
final KeyStore store = KeyStore.getInstance(KeyStore.getDefaultType());
var store = getKeyStoreInstance(KeyStore.getDefaultType());
store.load(null, null);
final CertificateFactory certFactory = CertificateFactory.getInstance("X.509");
int counter = 0;
Expand All @@ -239,6 +241,11 @@ private KeyStore buildTrustStoreFromCA() throws GeneralSecurityException, IOExce
return store;
}

@SuppressForbidden
private KeyStore getKeyStoreInstance(String type) throws KeyStoreException {
return KeyStore.getInstance(type);
}

private SSLContext createSslContext(KeyStore trustStore) throws GeneralSecurityException {
checkForTrustEntry(trustStore);
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

package org.opensearch.gradle.info;

import java.util.function.Function;

public class FipsBuildParams {

public static final String FIPS_BUILD_PARAM = "crypto.standard";

public static final String FIPS_ENV_VAR = "OPENSEARCH_CRYPTO_STANDARD";

private static String fipsMode;

public static void init(Function<String, Object> fipsValue) {
fipsMode = (String) fipsValue.apply(FIPS_BUILD_PARAM);
}

private FipsBuildParams() {}

public static boolean isInFipsMode() {
return "FIPS-140-3".equals(fipsMode);
}

public static String getFipsMode() {
return fipsMode;

Check warning on line 32 in buildSrc/src/main/java/org/opensearch/gradle/info/FipsBuildParams.java

View check run for this annotation

Codecov / codecov/patch

buildSrc/src/main/java/org/opensearch/gradle/info/FipsBuildParams.java#L32

Added line #L32 was not covered by tests
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@
File rootDir = project.getRootDir();
GitInfo gitInfo = gitInfo(rootDir);

FipsBuildParams.init(project::findProperty);

BuildParams.init(params -> {
// Initialize global build parameters
boolean isInternal = GlobalBuildInfoPlugin.class.getResource("/buildSrc.marker") != null;
Expand All @@ -129,7 +131,7 @@
params.setIsCi(System.getenv("JENKINS_URL") != null);
params.setIsInternal(isInternal);
params.setDefaultParallel(findDefaultParallel(project));
params.setInFipsJvm(Util.getBooleanProperty("tests.fips.enabled", false));
params.setInFipsJvm(FipsBuildParams.isInFipsMode());
params.setIsSnapshotBuild(Util.getBooleanProperty("build.snapshot", true));
if (isInternal) {
params.setBwcVersions(resolveBwcVersions(rootDir));
Expand Down Expand Up @@ -179,7 +181,11 @@
LOGGER.quiet(" JAVA_HOME : " + gradleJvm.getJavaHome());
}
LOGGER.quiet(" Random Testing Seed : " + BuildParams.getTestSeed());
LOGGER.quiet(" In FIPS 140 mode : " + BuildParams.isInFipsJvm());
if (FipsBuildParams.isInFipsMode()) {
LOGGER.quiet(" Crypto Standard : " + FipsBuildParams.getFipsMode());

Check warning on line 185 in buildSrc/src/main/java/org/opensearch/gradle/info/GlobalBuildInfoPlugin.java

View check run for this annotation

Codecov / codecov/patch

buildSrc/src/main/java/org/opensearch/gradle/info/GlobalBuildInfoPlugin.java#L185

Added line #L185 was not covered by tests
} else {
LOGGER.quiet(" Crypto Standard : any-supported");

Check warning on line 187 in buildSrc/src/main/java/org/opensearch/gradle/info/GlobalBuildInfoPlugin.java

View check run for this annotation

Codecov / codecov/patch

buildSrc/src/main/java/org/opensearch/gradle/info/GlobalBuildInfoPlugin.java#L187

Added line #L187 was not covered by tests
}
LOGGER.quiet("=======================================");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,13 @@ public class ForbiddenPatternsTask extends DefaultTask {
.exclude("**/*.ico")
.exclude("**/*.jar")
.exclude("**/*.zip")
.exclude("**/*.p12")
.exclude("**/*.jks")
.exclude("**/*.crt")
.exclude("**/*.der")
.exclude("**/*.pem")
.exclude("**/*.key")
.exclude("**/*.bcfks")
.exclude("**/*.keystore")
.exclude("**/*.png");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.gradle.api.NamedDomainObjectContainer;
import org.gradle.api.Project;
import org.gradle.api.Task;
import org.gradle.api.file.ConfigurableFileCollection;
import org.gradle.api.file.FileCollection;
import org.gradle.api.file.FileTree;
import org.gradle.api.plugins.jvm.JvmTestSuite;
Expand Down Expand Up @@ -87,6 +88,7 @@

private final NamedDomainObjectContainer<TestingConventionRule> naming;
private final Project project;
private final ConfigurableFileCollection extraClassPath = getProject().files();

Check warning on line 91 in buildSrc/src/main/java/org/opensearch/gradle/precommit/TestingConventionsTasks.java

View check run for this annotation

Codecov / codecov/patch

buildSrc/src/main/java/org/opensearch/gradle/precommit/TestingConventionsTasks.java#L91

Added line #L91 was not covered by tests

@Inject
public TestingConventionsTasks(Project project) {
Expand Down Expand Up @@ -398,7 +400,16 @@

@Classpath
public FileCollection getTestsClassPath() {
return Util.getJavaTestSourceSet(project).get().getRuntimeClasspath();
return Util.getJavaTestSourceSet(project).get().getRuntimeClasspath().plus(extraClassPath);

Check warning on line 403 in buildSrc/src/main/java/org/opensearch/gradle/precommit/TestingConventionsTasks.java

View check run for this annotation

Codecov / codecov/patch

buildSrc/src/main/java/org/opensearch/gradle/precommit/TestingConventionsTasks.java#L403

Added line #L403 was not covered by tests
}

@Classpath
public ConfigurableFileCollection getExtraClassPath() {
return extraClassPath;

Check warning on line 408 in buildSrc/src/main/java/org/opensearch/gradle/precommit/TestingConventionsTasks.java

View check run for this annotation

Codecov / codecov/patch

buildSrc/src/main/java/org/opensearch/gradle/precommit/TestingConventionsTasks.java#L408

Added line #L408 was not covered by tests
}

public void addExtraClassPath(Object... paths) {
extraClassPath.from(paths);

Check warning on line 412 in buildSrc/src/main/java/org/opensearch/gradle/precommit/TestingConventionsTasks.java

View check run for this annotation

Codecov / codecov/patch

buildSrc/src/main/java/org/opensearch/gradle/precommit/TestingConventionsTasks.java#L412

Added line #L412 was not covered by tests
}

private Map<String, File> walkPathAndLoadClasses(File testRoot) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import org.opensearch.gradle.Version;
import org.opensearch.gradle.VersionProperties;
import org.opensearch.gradle.info.BuildParams;
import org.opensearch.gradle.info.FipsBuildParams;
import org.gradle.api.Action;
import org.gradle.api.Named;
import org.gradle.api.NamedDomainObjectContainer;
Expand Down Expand Up @@ -546,17 +547,21 @@
logToProcessStdout("installed plugins");
}

if (FipsBuildParams.isInFipsMode() && keystorePassword.isEmpty()) {
throw new TestClustersException("Can not start " + this + " in FIPS JVM, missing keystore password");

Check warning on line 551 in buildSrc/src/main/java/org/opensearch/gradle/testclusters/OpenSearchNode.java

View check run for this annotation

Codecov / codecov/patch

buildSrc/src/main/java/org/opensearch/gradle/testclusters/OpenSearchNode.java#L551

Added line #L551 was not covered by tests
}

logToProcessStdout("Creating opensearch keystore with password set to [" + keystorePassword + "]");
if (keystorePassword.length() > 0) {
runOpenSearchBinScriptWithInput(keystorePassword + "\n" + keystorePassword, "opensearch-keystore", "create", "-p");
runOpenSearchBinScriptWithInput(keystorePassword + "\n" + keystorePassword + "\n", "opensearch-keystore", "create", "-p");

Check warning on line 556 in buildSrc/src/main/java/org/opensearch/gradle/testclusters/OpenSearchNode.java

View check run for this annotation

Codecov / codecov/patch

buildSrc/src/main/java/org/opensearch/gradle/testclusters/OpenSearchNode.java#L556

Added line #L556 was not covered by tests
} else {
runOpenSearchBinScript("opensearch-keystore", "-v", "create");
}

if (keystoreSettings.isEmpty() == false || keystoreFiles.isEmpty() == false) {
logToProcessStdout("Adding " + keystoreSettings.size() + " keystore settings and " + keystoreFiles.size() + " keystore files");

keystoreSettings.forEach((key, value) -> runKeystoreCommandWithPassword(keystorePassword, value.toString(), "add", "-x", key));
keystoreSettings.forEach((key, value) -> runKeystoreCommandWithPassword(keystorePassword, value.toString(), "add", key));

Check warning on line 564 in buildSrc/src/main/java/org/opensearch/gradle/testclusters/OpenSearchNode.java

View check run for this annotation

Codecov / codecov/patch

buildSrc/src/main/java/org/opensearch/gradle/testclusters/OpenSearchNode.java#L564

Added line #L564 was not covered by tests

for (Map.Entry<String, File> entry : keystoreFiles.entrySet()) {
File file = entry.getValue();
Expand Down Expand Up @@ -738,7 +743,12 @@
}

private void runKeystoreCommandWithPassword(String keystorePassword, String input, CharSequence... args) {
final String actualInput = keystorePassword.length() > 0 ? keystorePassword + "\n" + input : input;
final String actualInput;
if (keystorePassword.length() > 0) {
actualInput = keystorePassword + "\n" + input + "\n" + input;

Check warning on line 748 in buildSrc/src/main/java/org/opensearch/gradle/testclusters/OpenSearchNode.java

View check run for this annotation

Codecov / codecov/patch

buildSrc/src/main/java/org/opensearch/gradle/testclusters/OpenSearchNode.java#L748

Added line #L748 was not covered by tests
} else {
actualInput = input + "\n" + input;

Check warning on line 750 in buildSrc/src/main/java/org/opensearch/gradle/testclusters/OpenSearchNode.java

View check run for this annotation

Codecov / codecov/patch

buildSrc/src/main/java/org/opensearch/gradle/testclusters/OpenSearchNode.java#L750

Added line #L750 was not covered by tests
}
runOpenSearchBinScriptWithInput(actualInput, "opensearch-keystore", args);
}

Expand Down Expand Up @@ -786,6 +796,9 @@
// Override the system hostname variables for testing
defaultEnv.put("HOSTNAME", HOSTNAME_OVERRIDE);
defaultEnv.put("COMPUTERNAME", COMPUTERNAME_OVERRIDE);
if (FipsBuildParams.isInFipsMode()) {
defaultEnv.put(FipsBuildParams.FIPS_ENV_VAR, FipsBuildParams.getFipsMode());

Check warning on line 800 in buildSrc/src/main/java/org/opensearch/gradle/testclusters/OpenSearchNode.java

View check run for this annotation

Codecov / codecov/patch

buildSrc/src/main/java/org/opensearch/gradle/testclusters/OpenSearchNode.java#L800

Added line #L800 was not covered by tests
}

Set<String> commonKeys = new HashSet<>(environment.keySet());
commonKeys.retainAll(defaultEnv.keySet());
Expand Down
Binary file removed buildSrc/src/main/resources/cacerts.bcfks
Binary file not shown.
29 changes: 0 additions & 29 deletions buildSrc/src/main/resources/fips_java_bcjsse_11.policy

This file was deleted.

34 changes: 0 additions & 34 deletions buildSrc/src/main/resources/fips_java_bcjsse_8.policy

This file was deleted.

Loading
Loading