diff options
-rw-r--r-- | lib/ohai/plugins/fips.rb | 3 | ||||
-rw-r--r-- | spec/unit/plugins/fips_spec.rb | 4 |
2 files changed, 4 insertions, 3 deletions
diff --git a/lib/ohai/plugins/fips.rb b/lib/ohai/plugins/fips.rb index 7cf40fdf..fdb5c133 100644 --- a/lib/ohai/plugins/fips.rb +++ b/lib/ohai/plugins/fips.rb @@ -30,6 +30,7 @@ Ohai.plugin(:Fips) do fips Mash.new require "openssl" unless defined?(OpenSSL) - fips["kernel"] = { "enabled" => OpenSSL::OPENSSL_FIPS } + + fips["kernel"] = { "enabled" => defined?(OpenSSL.fips_mode) && OpenSSL.fips_mode } end end diff --git a/spec/unit/plugins/fips_spec.rb b/spec/unit/plugins/fips_spec.rb index 0925eb16..7fdf10bb 100644 --- a/spec/unit/plugins/fips_spec.rb +++ b/spec/unit/plugins/fips_spec.rb @@ -33,14 +33,14 @@ describe Ohai::System, "plugin fips" do context "when OpenSSL reports FIPS mode true" do it "sets fips enabled true" do - stub_const("OpenSSL::OPENSSL_FIPS", true) + allow(OpenSSL).to receive(:fips_mode).and_return(true) expect(subject).to be(true) end end context "when OpenSSL reports FIPS mode false" do it "sets fips enabled false" do - stub_const("OpenSSL::OPENSSL_FIPS", false) + allow(OpenSSL).to receive(:fips_mode).and_return(false) expect(subject).to be(false) end end |