RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1749346 - rpmbuild -bc krb5.spec failed in FIPS (python-sphinx - ValueError: [digital envelope routines: EVP_DigestInit_ex] disabled for FIPS)
Summary: rpmbuild -bc krb5.spec failed in FIPS (python-sphinx - ValueError: [digital ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: python-sphinx
Version: 8.1
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: rc
: 8.0
Assignee: Charalampos Stratakis
QA Contact: Dita Stehlikova
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-09-05 12:09 UTC by Filip Dvorak
Modified: 2021-05-18 16:28 UTC (History)
5 users (show)

Fixed In Version: python-sphinx-1.7.6-2.el8
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-05-18 16:28:19 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2021:1964 0 None None None 2021-05-18 16:28:20 UTC

Description Filip Dvorak 2019-09-05 12:09:38 UTC
Description of problem:
The command rpmbuild -bc krb5.spec failed in FIPS mode on RHEL-8.1 because of exception in python-sphinx 

Version-Release number of selected component (if applicable):
RHEL-8.1.0-20190821.0 
krb5-1.17-8.el8
python3-sphinx-1.7.6-1.el8

How reproducible:
Always

Steps to Reproduce:
1. enable FIPS mode on RHEL-8.1 machine with buildroot repo
2. dnf builddep krb5-*.src.rpm
3. rpmbuild -bc /root/rpmbuild/SPECS/krb5.spec

Actual results:
Exception occurred:
  File "/usr/lib/python3.6/site-packages/sphinx/builders/html.py", line 90, in get_stable_hash
    return md5(text_type(obj).encode('utf8')).hexdigest()
ValueError: [digital envelope routines: EVP_DigestInit_ex] disabled for FIPS
The full traceback has been saved in /tmp/sphinx-err-78iz6csi.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!
error: Bad exit status from /var/tmp/rpm-tmp.bJPseI (%build)

Expected results:
rpmbuild -bc /root/rpmbuild/SPECS/krb5.spec should finish successfully

Comment 2 Charalampos Stratakis 2019-09-05 12:37:35 UTC
What the use case of building an rpm in FIPS mode?

sphinx uses md5 in various locations and md5 is forbidden in FIPS (unless a specific workaround is used) so it seems that things are working the intended way.

Comment 3 Filip Dvorak 2019-09-05 13:11:25 UTC
I wanted to use it in the following test: TC#574625 FIPS: /CoreOS/krb5/Sanity/sanity-test-of-cipher-suites but I was talking with my colleagues and I think that it is possible to build a package in normal mode and then I can change mode to FIPS. 
Now I think that we can close this bug.

Comment 4 Robbie Harwood 2020-10-02 18:00:55 UTC
MD5 is forbidden for cryptographic use.  The use of MD5 for docs building is far from cryptographic, and moreover, completely arbitrary on sphinx's part.

The function it bails out on is this:

```python
def get_stable_hash(obj):
    # type: (Any) -> unicode                                                                                                                                                                                                                   
    """                                                                                                                                                                                                                                        
    Return a stable hash for a Python data structure.  We can't just use                                                                                                                                                                       
    the md5 of str(obj) since for example dictionary items are enumerated                                                                                                                                                                      
    in unpredictable order due to hash randomization in newer Pythons.                                                                                                                                                                         
    """
    if isinstance(obj, dict):
        return get_stable_hash(list(obj.items()))
    elif isinstance(obj, (list, tuple)):
        obj = sorted(get_stable_hash(o) for o in obj)
    return md5(text_type(obj).encode('utf8')).hexdigest()
```

So... not only is it non-cryptographic, but it could be almost any other hash.  sha2 would work.  Or, to avoid confusion entirely, you could use siphash.  Or any number of other things.  Or set the flag that it's not FIPS-related in openssl.

(Reopening because today I needed to build krb5 on my FIPS machine to test FIPS-specific patches, and cannot do so.)

Comment 6 Petr Viktorin (pviktori) 2020-10-02 19:47:17 UTC
Do you need Sphinx to test FIPS-specific patches? Can you build krb5 without the docs? Or build in a regular build environment instead of FIPS?


>  Or set the flag that it's not FIPS-related in openssl.

The usedforsecurity argument was added to Python 3.9; it'll take a few years before projects like Sphinx can use it. And I don't think this is worth patching downstream.

Comment 7 Robbie Harwood 2020-10-02 21:17:17 UTC
> Can you build krb5 without the docs?

By "docs" here we mean man pages.  At the point where I'm patching my build to not make man pages, I think it's about equivalent effort to just locally patch my sphinx.

Sure, I can work around your package being weirdly stubborn about this.  But now you're up to two people who wanted to be able to do this - and that's just for this package in particular.  It adds up.

> The usedforsecurity argument was added to Python 3.9; it'll take a few years before projects like Sphinx can use it.

So just use a different hash then.  The code just indicates it needs to be stable.

> And I don't think this is worth patching downstream.

I do.  Here's a patch: https://src.osci.redhat.com/rpms/python-sphinx/pull-request/1

Comment 8 Charalampos Stratakis 2020-10-05 08:22:43 UTC
Upstream sphinx is open to suggestions related to FIPS mode, e.g. check out https://github.com/sphinx-doc/sphinx/issues/7611

Comment 9 Petr Viktorin (pviktori) 2020-10-07 13:17:34 UTC
OK, let's try pushing it into 8.4.

For QA, the reproducer is building krb5 under FIPS mode.

Comment 17 errata-xmlrpc 2021-05-18 16:28:19 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 (python-sphinx 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/RHBA-2021:1964


Note You need to log in before you can comment on or make changes to this bug.