diff --git a/config/software/ruby.rb b/config/software/ruby.rb index 4a2d6f2294..99817e7564 100644 --- a/config/software/ruby.rb +++ b/config/software/ruby.rb @@ -357,25 +357,29 @@ end if fips_mode? - puts "<<<<<<< FIPS MODE >>>>>>>" + puts "Validating FIPS_MODE build" if windows? + puts "Reinstalling the openssl gem for Windows since it is installed with 1.1.1t for 3.1.x rubyinstaller" command "#{install_dir}/embedded/bin/gem install openssl -- --with-openssl-dir=#{install_dir}/embedded", env: env.merge({"OPENSSL_FIPS" => "1"}) + + puts "Finding all the rubies installed and checking their fips_mode status" find_command = %( Get-ChildItem c:/opscode -name 'ruby.exe' -recurse | ForEach-Object { - & $_ -e "require 'openssl'; puts OpenSSL::OPENSSL_VERSION_NUMBER.to_s(16); puts OpenSSL::OPENSSL_LIBRARY_VERSION; OpenSSL.fips_mode = 1" + & $_ -e "require 'openssl'; puts OpenSSL::OPENSSL_VERSION_NUMBER.to_s(16); puts OpenSSL::OPENSSL_LIBRARY_VERSION; OpenSSL.fips_mode = 1; puts 'FIPS mode successfully activated for Ruby' + RUBY_VERSION" } + Write-Output "done looking at rubies" ) + command find_command else find_command = %( find /opt -name 'ruby' | grep 'bin/ruby' | while read ruby; do echo "Checking $ruby" sum $ruby - $ruby -v -e "require 'openssl'; puts OpenSSL::OPENSSL_VERSION_NUMBER.to_s(16); puts OpenSSL::OPENSSL_LIBRARY_VERSION; OpenSSL.fips_mode = 1" + $ruby -v -e "require 'openssl'; puts OpenSSL::OPENSSL_VERSION_NUMBER.to_s(16); puts OpenSSL::OPENSSL_LIBRARY_VERSION; OpenSSL.fips_mode = 1; puts 'FIPS mode successfully activated for Ruby '+ RUBY_VERSION" done echo "done looking at rubies" ) command find_command end - puts ">>>>>>> FIPS MODE <<<<<<<" end end