-
Notifications
You must be signed in to change notification settings - Fork 1.9k
config: fips: bin: Initial implementation to enable FIPS compliance #12024
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
Open
cosmo0920
wants to merge
8
commits into
master
Choose a base branch
from
cosmo0920-making-fips-compliant-stage1
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
51fe57d
fips: Add FIPS initializing component
cosmo0920 d7e9997
config: Add a system config for FIPS
cosmo0920 ca0ef66
engine: Add a verification step for FIPS on enabled
cosmo0920 61951b3
bin: Provide a command line argument for FIPS verification
cosmo0920 18be864
out_s3: Add safe guard for FIPS compliance
cosmo0920 3047d5c
out_azure_blob: Block MD5 hash on fips enabled
cosmo0920 dca071f
tests: runtime: Add a test case for sha256 hash with FIPS
cosmo0920 b2d97ad
tests: internal: Compute an expected sha256 hash
cosmo0920 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| /* Fluent Bit | ||
| * ========== | ||
| * Copyright (C) 2015-2026 The Fluent Bit Authors | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| #ifndef FLB_FIPS_H | ||
| #define FLB_FIPS_H | ||
|
|
||
| struct flb_config; | ||
|
|
||
| int flb_fips_init(struct flb_config *config); | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| /* Fluent Bit | ||
| * ========== | ||
| * Copyright (C) 2015-2026 The Fluent Bit Authors | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| #include <fluent-bit/flb_info.h> | ||
| #include <fluent-bit/flb_config.h> | ||
| #include <fluent-bit/flb_fips.h> | ||
|
|
||
| #ifdef FLB_HAVE_OPENSSL | ||
| #include <openssl/err.h> | ||
| #include <openssl/evp.h> | ||
| #include <openssl/opensslv.h> | ||
| #if OPENSSL_VERSION_NUMBER >= 0x30000000L | ||
| #include <openssl/provider.h> | ||
| #endif | ||
| #endif | ||
|
|
||
| static void log_openssl_error(void) | ||
| { | ||
| #ifdef FLB_HAVE_OPENSSL | ||
| char errbuf[256]; | ||
| unsigned long err; | ||
|
|
||
| err = ERR_get_error(); | ||
| if (err != 0) { | ||
| ERR_error_string_n(err, errbuf, sizeof(errbuf)); | ||
| flb_error("[fips] OpenSSL error: %s", errbuf); | ||
| } | ||
| #endif | ||
| } | ||
|
|
||
| int flb_fips_init(struct flb_config *config) | ||
| { | ||
| int ret; | ||
|
|
||
| if (config == NULL) { | ||
| return -1; | ||
| } | ||
|
|
||
| if (config->fips_mode != FLB_TRUE) { | ||
| return 0; | ||
| } | ||
|
|
||
| if (config->fips_mode_active == FLB_TRUE) { | ||
| return 0; | ||
| } | ||
|
|
||
| #ifndef FLB_HAVE_OPENSSL | ||
| flb_error("[fips] security.fips_mode requires Fluent Bit to be built with OpenSSL"); | ||
| return -1; | ||
| #else | ||
| #if OPENSSL_VERSION_NUMBER < 0x30000000L | ||
| flb_error("[fips] security.fips_mode requires OpenSSL 3.0 or later"); | ||
| return -1; | ||
| #else | ||
| if (OSSL_PROVIDER_load(NULL, "base") == NULL) { | ||
| flb_error("[fips] failed to load OpenSSL base provider"); | ||
| log_openssl_error(); | ||
| return -1; | ||
| } | ||
|
|
||
| if (OSSL_PROVIDER_load(NULL, "fips") == NULL) { | ||
| flb_error("[fips] failed to load OpenSSL FIPS provider"); | ||
| log_openssl_error(); | ||
| return -1; | ||
| } | ||
|
|
||
| ret = EVP_default_properties_enable_fips(NULL, 1); | ||
| if (ret != 1) { | ||
| flb_error("[fips] failed to enable OpenSSL FIPS default properties"); | ||
| log_openssl_error(); | ||
| return -1; | ||
| } | ||
|
|
||
| ret = EVP_default_properties_is_fips_enabled(NULL); | ||
| if (ret != 1) { | ||
| flb_error("[fips] OpenSSL FIPS default properties are not enabled"); | ||
| return -1; | ||
| } | ||
|
|
||
| config->fips_mode_active = FLB_TRUE; | ||
| flb_info("[fips] OpenSSL FIPS mode enabled"); | ||
|
|
||
| return 0; | ||
| #endif | ||
| #endif | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.