A number of bugs behave slightly differently when FIPS mode is enabled.
It would be nice to have a Python method which checks for the presence of fips.
NOTE: A patch is well underway which implements this relatively simple function using "sysctl".
Metadata Update from @mharmsen: - Custom field component adjusted to General - Custom field feature adjusted to '' - Custom field origin adjusted to Community - Custom field proposedmilestone adjusted to '' - Custom field proposedpriority adjusted to '' - Custom field reviewer adjusted to '' - Custom field type adjusted to defect - Custom field version adjusted to '' - Issue assigned to mharmsen - Issue priority set to: critical - Issue set to the milestone: 10.4
Here is a simple function that reads fips state from proc:
def is_fips_enabled(): try: with open('/proc/sys/crypto/fips_enabled') as f: value = f.read() except IOError: return None return value.strip() != '0'
Here is a simple function that reads fips state from proc: def is_fips_enabled(): try: with open('/proc/sys/crypto/fips_enabled') as f: value = f.read() except IOError: return None return value.strip() != '0'
While this would work, I am going to propose something closer to the routine shown below (with a couple of enhancements such as logging as used within the context of pkispawn helper methods) for a couple of reasons:
This routine would look similar to this:
def is_fips_enabled(self, critical_failure=True): try: # Check to see if FIPS is enabled on this system command = ["sysctl", "crypto.fips_enabled", "-bn"] # Execute this "sysctl" command. with open(os.devnull, "w") as fnull: output = subprocess.check_output(command, stderr=fnull, close_fds=True) if (output != "0"): return True else: return False except subprocess.CalledProcessError as exc: print "CalledProcessError %s" % exc if critical_failure: raise except OSError as exc: print "OSError %s" % exc if critical_failure: raise return False
Metadata Update from @mharmsen: - Custom field rhbz adjusted to https://bugzilla.redhat.com/show_bug.cgi?id=1427695
commit 641180a465d7fdf12a978c9c458e39bf6829cac2 Author: Matthew Harmsen mharmsen@redhat.com Date: Tue May 16 12:58:17 2017 -0600 Added FIPS class to pkispawn Bugzilla Bug #1450143 - CA installation with HSM in FIPS mode fails dogtagpki Pagure Issue #2684 - CA installation with HSM in FIPS mode fails commit 4f11d3b2aad075c965bbccb61112d443e36e4c45 Author: Matthew Harmsen mharmsen@redhat.com Date: Mon May 15 15:06:04 2017 -0600 Added runtime requirement on sysctl to pki-core spec file
Metadata Update from @mharmsen: - Issue close_status updated to: fixed - Issue set to the milestone: 10.4.5 (was: 10.4) - Issue status updated to: Closed (was: Open)
Metadata Update from @mharmsen: - Custom field fixedinversion adjusted to pki-core-10.4.7-1.fc27
Dogtag PKI is moving from Pagure issues to GitHub issues. This means that existing or new issues will be reported and tracked through Dogtag PKI's GitHub Issue tracker.
This issue has been cloned to GitHub and is available here: https://github.com/dogtagpki/pki/issues/2805
If you want to receive further updates on the issue, please navigate to the GitHub issue and click on Subscribe button.
Subscribe
Thank you for understanding, and we apologize for any inconvenience.