-
Notifications
You must be signed in to change notification settings - Fork 449
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
Fix FIPS mode detection #1754
Fix FIPS mode detection #1754
Conversation
9d26dc5
to
cd3bbaf
Compare
lib/ohai/plugins/fips.rb
Outdated
@@ -30,6 +30,6 @@ | |||
fips Mash.new | |||
|
|||
require "openssl" unless defined?(OpenSSL) | |||
fips["kernel"] = { "enabled" => OpenSSL::OPENSSL_FIPS } | |||
fips["kernel"] = { "enabled" => OpenSSL.fips_mode } |
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.
Oh, I see this was reverted in ab6180b. OpenSSL v3.0 may not have fips_mode
: https://wiki.openssl.org/index.php/OpenSSL_3.0
Previously FIPS detection relied on the `OpenSSL::OPENSSL_FIPS` constant being defined. However, on RedHat operating systems, this constant is always defined in `/usr/include/openssl/opensslconf-x86_64.h`. As a result, on such operating systems FIPS mode would erroneously be labeled as enabled. This constant is a necessary but not sufficient condition to determine whether FIPS is actually enabled. OpenSSL has a runtime `fips_mode` check (https://wiki.openssl.org/index.php/FIPS_mode()) that should be used instead. Ruby will use this if the `OPENSSL_FIPS` compile-time constant is available: https://github.com/ruby/ruby/blob/685efac05983dee44ce2d96c24f2fcb96a0aebe2/ext/openssl/ossl.c#L413-L428 Signed-off-by: Stan Hu <[email protected]>
cd3bbaf
to
754de96
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
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.
LGTM. We ship with our own OpenSSL, so this should be fine.
Thanks @jaymzh. What's left to merge this? |
Description
Previously FIPS detection relied on the
OpenSSL::OPENSSL_FIPS
constant being defined. However, on RedHat operating systems, this
constant is always defined in
/usr/include/openssl/opensslconf-x86_64.h
. As a result, on suchoperating systems FIPS mode would erroneously be labeled as enabled.
This constant is a necessary but not sufficient condition to determine
whether FIPS is actually enabled.
OpenSSL has a runtime
fips_mode
check(https://wiki.openssl.org/index.php/FIPS_mode()) that should be used
instead. Ruby will use this if the
OPENSSL_FIPS
compile-timeconstant is available:
https://github.com/ruby/ruby/blob/685efac05983dee44ce2d96c24f2fcb96a0aebe2/ext/openssl/ossl.c#L413-L428
Related Issue
Types of changes
Checklist: