Bug 1971679

Summary: Improve system FIPS detection [java-1.8.0-openjdk, RHEL 8]
Product: Red Hat Enterprise Linux 8 Reporter: Andrew John Hughes <ahughes>
Component: java-1.8.0-openjdkAssignee: Andrew John Hughes <ahughes>
Status: CLOSED ERRATA QA Contact: OpenJDK QA <java-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.4CC: jandrlik, jvanek
Target Milestone: rcKeywords: Triaged, ZStream
Target Release: 8.5Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: java-1.8.0-openjdk-1.8.0.302.b08-2.el8 Doc Type: Bug Fix
Doc Text:
Previously, OpenJDK's FIPS mode would be enabled if it detected that the system crypto policy was set to FIPS. This meant that containers running on a FIPS mode kernel would not enable FIPS mode without the crypto policy being changed. With this update, OpenJDK queries the NSS library as to whether FIPS mode is active or not.
Story Points: ---
Clone Of:
: 2014201 (view as bug list) Environment:
Last Closed: 2021-11-09 17:44:15 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2014201    

Description Andrew John Hughes 2021-06-14 14:31:08 UTC
This bug was initially created as a copy of Bug #1929465

I am copying this bug because: 

FIPS support should be in sync across all supported JDKs.

Description of problem:

OpenJDK needs to detect whether it is running on a FIPS-configured RHEL system or not at startup in order to make automatic configurations. Please note that this default behavior can be explicitly disabled by the user through the com.redhat.fips system property (i.e.: -Dcom.redhat.fips=false); or, more indirectly, through the java.security.disableSystemPropertiesFile system property (i.e.: -Djava.security.disableSystemPropertiesFile=true) or the security.useSystemPropertiesFile security property (i.e.: security.useSystemPropertiesFile=false).

To detect if the system is in FIPS mode, OpenJDK is reading the /etc/crypto-policies/config configuration file and looking for a line containing 'FIPS' only. This is an internal and non-supported API, known to be failing in these cases: 1) in Common Criteria systems (FIPS with additional constraints) such line is 'FIPS:OSPP'; and 2) in FIPS-configured containers, the value may not reflect the applicable configuration. Given that this API is not supported, there is a high risk that more cases begin to fail in the future -eventually, every case-.

As a result, OpenJDK needs to change the way in which detects if the systems is in FIPS mode by using a supported API. The preferred API is NSS's SECMOD_GetSystemFIPSEnabled function. /proc/sys/crypto/fips_enabled may be used as a fallback scheme -libraries in RHEL 9 are moving to it-.

Version-Release number of selected component (if applicable):

RHEL 8.3, 8.4

How reproducible:

Always.

Steps to Reproduce:
1. Deploy an OpenJDK container in a FIPS-configured RHEL OR deploy OpenJDK on a Common Criteria configured RHEL
2. Check the list of security providers enabled in OpenJDK

Actual results:

Number of providers: 12
Provider: SUN version 11
Provider: SunRsaSign version 11
Provider: SunEC version 11
Provider: SunJSSE version 11
Provider: SunJCE version 11
Provider: SunJGSS version 11
Provider: SunSASL version 11
Provider: XMLDSig version 11
Provider: SunPCSC version 11
Provider: JdkLDAP version 11
Provider: JdkSASL version 11
Provider: SunPKCS11 version 11

Expected results:

Number of providers: 4
Provider: SunPKCS11-NSS-FIPS version 11
Provider: SUN version 11
Provider: SunEC version 11
Provider: SunJSSE version 11

Additional info:

-

Comment 11 errata-xmlrpc 2021-11-09 17:44:15 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (java-1.8.0-openjdk bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2021:3864