Use env variable (OPENSEARCH_FIPS_MODE) to enable opensearch to run in FIPS enforced mode instead of checking for existence of bcFIPS jars#20625
Conversation
…n FIPS enforced mode instead of checking for existence of bcFIPS jars Signed-off-by: Craig Perkins <cwperx@amazon.com>
📝 WalkthroughWalkthroughThe changes replace automatic FIPS mode detection based on BouncyCastle FIPS JAR presence with an explicit environment variable configuration (OPENSEARCH_FIPS_MODE). Startup scripts for both Unix and Windows now check this variable to enable FIPS, and test configurations are updated to set it for FIPS compliance testing. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (4)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (21)
🔇 Additional comments (3)
✏️ Tip: You can disable this entire section by setting Comment |
Signed-off-by: Craig Perkins <cwperx@amazon.com>
|
@beanuwave let me know what you think of this change. I think we should change the check to something different and not have it be checking for the existence of bcFips jars under the If the change in this PR looks ok, then I will raise a docs PR to accompany this. |
|
❗ AI-powered Code-Diff-Analyzer found issues on commit 4cb633e.
The table above displays the top 10 most important findings. Pull Requests Author(s): Please update your Pull Request according to the report above. Repository Maintainer(s): You can Thanks. |
|
❌ Gradle check result for 4cb633e: 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? |
|
@cwperks I like this approach - it's one step closer to having |
Signed-off-by: Craig Perkins <cwperx@amazon.com>
|
❌ Gradle check result for 08723c6: 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? |
|
@beanuwave agreed on running the entire gradle check against a distro built with |
|
❌ Gradle check result for 08723c6: null 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 08723c6: 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? |
| set OPENSEARCH_JAVA_OPTS=-Dorg.bouncycastle.fips.approved_only=true -Djava.security.properties="%OPENSEARCH_PATH_CONF%\fips_java.security" %OPENSEARCH_JAVA_OPTS% | ||
| REM FIPS mode is runtime-configured via env var (default: false) | ||
| if "%OPENSEARCH_FIPS_MODE%"=="" set "OPENSEARCH_FIPS_MODE=false" | ||
|
|
There was a problem hiding this comment.
@cwperks I would keep the if exist "%OPENSEARCH_HOME%\lib\bc-fips*.jar" ( check, people do tailor distributions (for whatever reasons), if the bc-fips libraries are not present, the FIPS related settings are noop essentially, we should fail to start
Description
This PR updates logic in
./bin/opensearch-env(and/bin/opensearch-env.bat) to change the condition for running in FIPS approved mode. Currently, opensearch-env checks for the existence ofbc-fips*jars under thelib/folder and accordingly adds system props to ensure opensearch enforces FIPS-approved security policy. bc-fips folders are not currently included in the default distribution, and need to be built in from source by creating a distribution with the FIPS build param (-Pcrypto.standard=FIPS-140-3).When the min distribution and default distribution start building with
-Pcrypto.standard=FIPS-140-3by default, then it would mean that this block is always hit and FIPS approved mode would be enforced. We do not (yet) want that to be default and instead rely on a cluster administrator to explicitly enable that.This PR introduces an env var (
OPENSEARCH_FIPS_MODE) that a cluster admin can use to enable it.For example
Related Issues
Resolves opensearch-project/opensearch-build#5979
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.