Bug 746118 - In FIPS mode, weberror throws unhandled exception
In FIPS mode, weberror throws unhandled exception
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: python-weberror (Show other bugs)
6.4
Unspecified Unspecified
high Severity high
: rc
: ---
Assigned To: Jan Pokorný
qe-baseos-daemons
:
Depends On:
Blocks: 782183 956360
  Show dependency treegraph
 
Reported: 2011-10-13 19:16 EDT by jared jennings
Modified: 2013-11-21 18:53 EST (History)
9 users (show)

See Also:
Fixed In Version: python-weberror-0.10.2-2.el6
Doc Type: Bug Fix
Doc Text:
Cause: WebError, a middleware handling web application's errors, used to yield unique error identification as purpose-specific encoding of MD5 digest of traceback-based inputs. Nowadays, this algorithm is discouraged, and in turn implicitly refused by Python's runtime in case of FIPS mode. Consequence: Some web applications using WebError may not work correctly upon risen exception under FIPS mode. Fix: In parallel with upstream development, pragmatic approach to session identification is applied -- the value is not generated automatically, avoiding the possible failure in FIPS mode when not needed. Applications relying on this value are still not compatible with FIPS in favor of backward compatibility. Result: Unless explicitly required, WebError no longer actively computes MD5 digest, so in such case, the errors handling in respective web applications does not suffer in FIPS mode.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-11-21 18:53:01 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description jared jennings 2011-10-13 19:16:49 EDT
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.
Comment 2 RHEL Product and Program Management 2011-10-13 19:48:23 EDT
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.
Comment 3 Dave Malcolm 2011-10-14 15:33:49 EDT
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]
Comment 4 jared jennings 2011-10-14 15:47:46 EDT
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).
Comment 5 jared jennings 2011-10-25 13:19:47 EDT
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.
Comment 8 RHEL Product and Program Management 2012-09-07 01:22:05 EDT
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.
Comment 10 Jan Pokorný 2013-06-27 14:41:25 EDT
This bug has to be solved in order to make luci happy in FIPS mode,
assigning myself.
Comment 12 Jan Pokorný 2013-07-15 17:51:48 EDT
Upstream conversion, 2nd edition:
https://github.com/Pylons/weberror/issues/6
Comment 13 Jan Pokorný 2013-07-16 16:30:30 EDT
(s/conversion/conversation/ but conversion md5->sha256 also fits)
Comment 14 Jan Pokorný 2013-08-05 17:42:31 EDT
Pull request ("fixing" it the other way around) accepted: [1].

[1] https://github.com/Pylons/weberror/pull/7
Comment 22 jared jennings 2013-08-27 18:02:16 EDT
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.
Comment 23 Jan Pokorný 2013-08-30 12:48:30 EDT
Jared, no problem, nice to see no objections :)
Comment 25 errata-xmlrpc 2013-11-21 18:53:01 EST
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

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