Bug 746118 - In FIPS mode, weberror throws unhandled exception
Summary: In FIPS mode, weberror throws unhandled exception
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: python-weberror
Version: 6.4
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: ---
Assignee: Jan Pokorný [poki]
QA Contact: qe-baseos-daemons
URL:
Whiteboard:
Depends On:
Blocks: 782183 956360
TreeView+ depends on / blocked
 
Reported: 2011-10-13 23:16 UTC by jared jennings
Modified: 2018-12-03 17:23 UTC (History)
9 users (show)

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.
Clone Of:
Environment:
Last Closed: 2013-11-21 23:53:01 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:1723 normal SHIPPED_LIVE python-weberror bug fix update 2013-11-20 21:51:31 UTC
Red Hat Bugzilla 956360 None None None Never

Internal Links: 956360

Description jared jennings 2011-10-13 23:16:49 UTC
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 23:48:23 UTC
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 19:33:49 UTC
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 19:47:46 UTC
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 17:19:47 UTC
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 05:22:05 UTC
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ý [poki] 2013-06-27 18:41:25 UTC
This bug has to be solved in order to make luci happy in FIPS mode,
assigning myself.

Comment 12 Jan Pokorný [poki] 2013-07-15 21:51:48 UTC
Upstream conversion, 2nd edition:
https://github.com/Pylons/weberror/issues/6

Comment 13 Jan Pokorný [poki] 2013-07-16 20:30:30 UTC
(s/conversion/conversation/ but conversion md5->sha256 also fits)

Comment 14 Jan Pokorný [poki] 2013-08-05 21:42:31 UTC
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 22:02:16 UTC
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ý [poki] 2013-08-30 16:48:30 UTC
Jared, no problem, nice to see no objections :)

Comment 25 errata-xmlrpc 2013-11-21 23:53:01 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, 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.