-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for FIPS compliance mode #14912
base: main
Are you sure you want to change the base?
Support for FIPS compliance mode #14912
Conversation
❌ Gradle check result for 6016d5d: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
8e8ed47
to
6016d5d
Compare
❌ Gradle check result for 8e8ed47: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
❌ Gradle check result for 6016d5d: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
.../identity-shiro/src/main/java/org/opensearch/identity/shiro/realm/BCryptPasswordMatcher.java
Outdated
Show resolved
Hide resolved
Could use some help maybe from @cwperks or @peternied reviewing this, please. |
buildSrc/src/main/java/org/opensearch/gradle/testclusters/OpenSearchNode.java
Outdated
Show resolved
Hide resolved
@beanuwave @peternied Have you been able to perform any of the following testing?
As this stands (correct me if I'm mistaken), at the very least, OpenSAML would be broken and there may be multiple versions of the Bouncy Castle libraries running in the JVM resulting in jar hell? @dancristiancecoi has raised opensearch-project/security#4915 to discuss the OpenSAML options. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is also a potential issue on setting this password. On a FIPS-enabled environment and org.bouncycastle.fips.approved_only=true this appears to throw the following exception. Have you seen this?
Exception in thread "main" org.bouncycastle.crypto.fips.FipsUnapprovedOperationError: password must be at least 112 bits
at org.bouncycastle.crypto.fips.FipsPBKD$Parameters.<init>(Unknown Source)
at org.bouncycastle.crypto.fips.FipsPBKD$Parameters.<init>(Unknown Source)
at org.bouncycastle.crypto.fips.FipsPBKD$ParametersBuilder.using(Unknown Source)
at org.bouncycastle.jcajce.provider.ProvPBEPBKDF2$BasePBKDF2.engineGenerateSecret(Unknown Source)
at java.base/javax.crypto.SecretKeyFactory.generateSecret(SecretKeyFactory.java:340)
at org.opensearch.common.settings.KeyStoreWrapper.createCipher(KeyStoreWrapper.java:349)
at org.opensearch.common.settings.KeyStoreWrapper.encrypt(KeyStoreWrapper.java:434)
at org.opensearch.common.settings.KeyStoreWrapper.save(KeyStoreWrapper.java:545)
at org.opensearch.bootstrap.Bootstrap.loadSecureSettings(Bootstrap.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's also the reason why all ITs do have keystore password set when executed in FIPS mode. I've also listed this requirement under 'Runtime limitations' in the opening description.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's also the reason why all ITs do have keystore password set when executed in FIPS mode. I've also listed this requirement under 'Runtime limitations' in the opening description.
Cool, that makes sense.
I think there are ways that this code can be made more forgiving for FIPS mode - one possibility could be to apply the KEYSTORE_PASSWORD if set in the environment? It may need more investigation to confirm.
You are correct, the security plugin needs many tweaks before it can run with FIPS libs only. I've done no further digging since we've been discussing the OpenSAML issue. Regarding a full build on a standalone cluster, most scenarios are well tested through ITs - do you see the need for more test scenarios? I'm also curious about the outcome when the test suite is executed against FIPS-enabled CentOS9. In some cases, such as RC4, the implementation is done by SunJCE and can be instantiated by any third-party framework, regardless of any restrictions by the OS. I am currently working on a solution to this issue. |
Yes I appreciate that your tests have added much more coverage. I'm just wary of gaps, especially in other plugins, where testing in this area understandably doesn't exist yet. I find that running a standalone deployment will flush out more issues and was curious to know the testing approaches you had taken so far. |
❌ Gradle check result for af1f3ee: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
af1f3ee
to
b7f6360
Compare
❌ Gradle check result for b7f6360: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
b7f6360
to
fdce790
Compare
❌ Gradle check result for fdce790: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
fdce790
to
b612556
Compare
Signed-off-by: Iwan Igonin <iigonin@sternad.de> # Conflicts: # server/build.gradle
Signed-off-by: Iwan Igonin <iigonin@sternad.de> � Please enter the commit message for your changes. Lines starting � with '�' will be ignored, and an empty message aborts the commit. � � interactive rebase in progress; onto 4b284c5 � Last commands done (2 commands done): � pick a47f4e6 Draft to allow run in FIPS compliace mode � pick 0bee0a8 make tests run without BC (not BCFIPS) libraries. � Next commands to do (8 remaining commands): � pick 4fc6201 disable approved-only mode for launch configuration of testcluster � pick 321929f update all BC libraries to support JAVA 21 � You are currently rebasing branch 'fips_compliance2' on '4b284c54270'. � � Changes to be committed: � modified: buildSrc/build.gradle � modified: buildSrc/src/main/java/org/opensearch/gradle/OpenSearchTestBasePlugin.java � modified: buildSrc/src/main/java/org/opensearch/gradle/info/BuildParams.java � modified: client/rest/build.gradle � new file: client/rest/licenses/bc-fips-1.0.2.4.jar.sha1 � new file: client/rest/licenses/bctls-fips-1.0.19.jar.sha1 � new file: client/rest/licenses/bouncycastle-LICENSE.txt � new file: client/rest/licenses/bouncycastle-NOTICE.txt � modified: client/rest/src/test/java/org/opensearch/client/RestClientBuilderIntegTests.java � modified: distribution/src/config/fips_java.security � modified: distribution/tools/keystore-cli/src/test/java/org/opensearch/common/settings/AddFileKeyStoreCommandTests.java � modified: distribution/tools/keystore-cli/src/test/java/org/opensearch/common/settings/AddStringKeyStoreCommandTests.java � modified: distribution/tools/keystore-cli/src/test/java/org/opensearch/common/settings/ChangeKeyStorePasswordCommandTests.java � modified: distribution/tools/keystore-cli/src/test/java/org/opensearch/common/settings/KeyStoreWrapperTests.java � modified: distribution/tools/keystore-cli/src/test/java/org/opensearch/common/settings/ListKeyStoreCommandTests.java � modified: distribution/tools/keystore-cli/src/test/java/org/opensearch/common/settings/RemoveSettingKeyStoreCommandTests.java � modified: distribution/tools/launchers/src/main/java/org/opensearch/tools/launchers/SystemJvmOptions.java � modified: distribution/tools/plugin-cli/build.gradle � modified: gradle/libs.versions.toml � modified: libs/ssl-config/build.gradle � deleted: libs/ssl-config/licenses/bc-fips-1.0.2.5.jar.sha1 � new file: libs/ssl-config/licenses/bouncycastle-LICENSE.txt � new file: libs/ssl-config/licenses/bouncycastle-NOTICE.txt � modified: libs/ssl-config/src/main/java/org/opensearch/common/ssl/DefaultJdkTrustConfig.java � modified: libs/ssl-config/src/main/java/org/opensearch/common/ssl/PemUtils.java � modified: libs/ssl-config/src/test/java/org/opensearch/common/ssl/PemKeyConfigTests.java � modified: libs/ssl-config/src/test/java/org/opensearch/common/ssl/PemTrustConfigTests.java � modified: libs/ssl-config/src/test/java/org/opensearch/common/ssl/PemUtilsTests.java � modified: modules/reindex/src/test/java/org/opensearch/index/reindex/ReindexRestClientSslTests.java � modified: modules/transport-netty4/build.gradle � modified: modules/transport-netty4/src/test/java/org/opensearch/http/netty4/ssl/SecureNetty4HttpServerTransportTests.java � modified: modules/transport-netty4/src/test/java/org/opensearch/transport/netty4/ssl/SimpleSecureNetty4TransportTests.java � deleted: modules/transport-netty4/src/test/resources/netty4-secure.jks � new file: modules/transport-netty4/src/test/resources/netty4-secure.p12 � modified: plugins/discovery-azure-classic/src/internalClusterTest/java/org/opensearch/discovery/azure/classic/AzureDiscoveryClusterFormationTests.java � deleted: plugins/identity-shiro/licenses/bcprov-jdk18on-1.78.jar.sha1 � deleted: plugins/identity-shiro/licenses/bcprov-jdk18on-LICENSE.txt � new file: plugins/identity-shiro/licenses/password4j-1.8.2.jar.sha1 � new file: plugins/identity-shiro/licenses/password4j-LICENSE.txt � renamed: plugins/identity-shiro/licenses/bcprov-jdk18on-NOTICE.txt -> plugins/identity-shiro/licenses/password4j-NOTICE.txt � modified: plugins/identity-shiro/src/main/java/org/opensearch/identity/shiro/realm/BCryptPasswordMatcher.java � modified: plugins/repository-azure/build.gradle � modified: plugins/telemetry-otel/build.gradle � modified: server/build.gradle � new file: server/licenses/bc-fips-1.0.2.4.jar.sha1 � new file: server/licenses/bctls-fips-1.0.19.jar.sha1 � new file: server/licenses/bouncycastle-LICENSE.txt � new file: server/licenses/bouncycastle-NOTICE.txt � modified: server/src/main/java/org/opensearch/bootstrap/Bootstrap.java � modified: server/src/main/java/org/opensearch/common/settings/FipsSettings.java � modified: server/src/main/java/org/opensearch/common/settings/KeyStoreWrapper.java � modified: server/src/main/resources/org/opensearch/bootstrap/security.policy � modified: server/src/main/resources/org/opensearch/bootstrap/test-framework.policy �
Signed-off-by: Iwan Igonin <iigonin@sternad.de> # Conflicts: # buildSrc/version.properties
Signed-off-by: Iwan Igonin <iigonin@sternad.de>
Signed-off-by: Iwan Igonin <iigonin@sternad.de>
…ional tests. Signed-off-by: Iwan Igonin <iigonin@sternad.de>
Signed-off-by: Iwan Igonin <iigonin@sternad.de>
Signed-off-by: Iwan Igonin <iigonin@sternad.de>
Signed-off-by: Iwan Igonin <iigonin@sternad.de>
Signed-off-by: Iwan Igonin <iigonin@sternad.de>
Signed-off-by: Iwan Igonin <iigonin@sternad.de>
…Pattern Signed-off-by: Iwan Igonin <iigonin@sternad.de>
b612556
to
7a93e82
Compare
❌ Gradle check result for 7a93e82: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
7a93e82
to
21dd2b2
Compare
❌ Gradle check result for 21dd2b2: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Summery: - replace unsecure kerberos crypto algorithms - add 'java.security.KeyStore' to forbidden-apis - instantiate and use SecureRandom from BCFIPS library - exclude SunJCE from security providers list at runtime, when running in FIPS JVM - exclude Azure tests when running in FIPS JVM Signed-off-by: Iwan Igonin <iigonin@sternad.de>
21dd2b2
to
2fdb220
Compare
Description
This PR makes FIPS mode available through the
OPENSEARCH_CRYPTO_STANDARD=FIPS-140-3
environmental parameter instead of thetests.fips.enabled
setting. It provides FIPS 140-3 support by replacing all BC dependencies with BCFIPS dependencies and making FIPS approved-only mode configurable at launch. Running this mode restricts the BCFIPS provider to rely solely on FIPS-certified ciphers.fips.gradle
build script is removed in order to support a single-build solution.java.security
file is added to the build to distinguish between FIPS and non-FIPS environments.fips_java.security
file is altered due to evolving security standards.security.policy
file is altered to grant necessary security permissions.Runtime limitations (known so far) that come with enabling FIPS mode:
Adminis can continue to manage their systems without being impacted by this change. However, for those keen on FIPS compliance, the most common obstacle will likely be the requirement to set a stronger password for the internal keystore and also convert key and truststores to *.bcfks format.
ssl.verification_mode=NONE
setting is not permitted.Reasons for refactoring
PemUtils
, which is used by the Reindex API in cases of migrating data from a remote cluster that is TLS protected:Related Issues
opensearch-project/security#3420
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.