Red Hat Bugzilla – Bug 746118
In FIPS mode, weberror throws unhandled exception
Last modified: 2013-11-21 18:53:01 EST
WebError uses the MD5 hash by default in one of its functions. On a host configured for FIPS compliance, any attempt at using the MD5 hash from Python throws an exception. I've filed an upstream issue at https://bitbucket.org/bbangert/weberror/issue/8/ The way I first saw the problem was by creating a trivial Pylons web application, incorrectly, and trying it out using paster serve development.ini. My application threw an exception, and (some part of) Pylons wanted to create a URL I could use to debug it. That process uses hash_identifier, which threw the above exception. Version: python-weberror-0.10.2-1.el6.noarch Simplest way to reproduce: root@rhel6w-32 ~ # python Python 2.6.6 (r266:84292, Apr 11 2011, 15:52:27) [GCC 4.4.4 20100726 (Red Hat 4.4.4-13)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from weberror.util.serial_number_generator import hash_identifier >>> hash_identifier('foo', 8) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.6/site-packages/weberror/util/serial_number_generator.py", line 65, in hash_identifier h = hasher(str(s)) ValueError: error:060800A0:digital envelope routines:EVP_DigestInit_ex:unknown cipher Here's how it looks when it works right: root@rhel6w-32 ~ # python Python 2.6.6 (r266:84292, Apr 11 2011, 15:52:27) [GCC 4.4.4 20100726 (Red Hat 4.4.4-13)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from weberror.util.serial_number_generator import hash_identifier >>> hash_identifier('foo', 8) '4ehvhq4j' To get this behavior, I made the default hasher sha256 instead of md5.
This request was evaluated by Red Hat Product Management for inclusion in the current release of Red Hat Enterprise Linux. Because the affected component is not scheduled to be updated in the current release, Red Hat is unfortunately unable to address this request at this time. Red Hat invites you to ask your support representative to propose this request, if appropriate and relevant, in the next release of Red Hat Enterprise Linux. If you would like it considered as an exception in the current release, please ask your support representative.
Thanks for filing this bug report. As noted above, please ask your support representative if you wish to escalate this issue. By the way, it may be worth noting that RHEL 6's python has some FIPS fixes compared to a "vanilla" upstream build of Python. In FIPS compliance mode, a vanilla build of Python segfaults when attempting to use non-FIPS-compliant hash algorithms (such as MD5), due to a lack of error-checking for this case within the the _hashlib module (which is implemented in C). We patched it in RHEL 6.0 to fix the segfault, and raise an exception instead, which is the ValueError exception that you're seeing. So the ValueError exception is, strictly speaking, a non-standard RHEL-ism, albeit an improvement over a segfault. [I submitted a version of the patch upstream as part of: http://bugs.python.org/issue9216 for Python 3, which covers some additional API extensions, though that has not been accepted there yet (upstream Python 2.* is now in permanent feature freeze, in lieu of Python 3). RHEL 6.0 has a backport of that work, to Python 2.6. This change was bug 563986, though I don't know if you will be able to read that bug; it's currently marked as only visible to users in the RHEL Public Beta group]
Brilliant work, Dave! I was indeed pleased to see Python raise a ValueError, because I found that same segfault in the Ruby interpreter a little while ago (Bug #717709, http://redmine.ruby-lang.org/issues/4944).
I started support case 550989 to try to speed up a fix to this. There's a discussion of alternatives in https://bitbucket.org/bbangert/weberror/issue/8/, and a patch at https://bitbucket.org/jaredj/fips-compatibility/raw/0c2eae995825/use-sha256-if-md5-fails.
This request was evaluated by Red Hat Product Management for inclusion in the current release of Red Hat Enterprise Linux. Because the affected component is not scheduled to be updated in the current release, Red Hat is unable to address this request at this time. Red Hat invites you to ask your support representative to propose this request, if appropriate, in the next release of Red Hat Enterprise Linux.
This bug has to be solved in order to make luci happy in FIPS mode, assigning myself.
Upstream conversion, 2nd edition: https://github.com/Pylons/weberror/issues/6
(s/conversion/conversation/ but conversion md5->sha256 also fits)
Pull request ("fixing" it the other way around) accepted: [1]. [1] https://github.com/Pylons/weberror/pull/7
Jan, thanks for your work on this. I'm sorry I never got back to you on your original question, but your solution is a good one and does what's needed.
Jared, no problem, nice to see no objections :)
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, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHBA-2013-1723.html