Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1250611

Summary: SSLContext.load_cert_chain() keyfile argument can't be set to None
Product: Red Hat Enterprise Linux 7 Reporter: Christian Heimes <cheimes>
Component: pythonAssignee: Robert Kuska <rkuska>
Status: CLOSED ERRATA QA Contact: Branislav NĂ¡ter <bnater>
Severity: high Docs Contact:
Priority: unspecified    
Version: 7.2CC: edewata, florian, isenfeld, jberan, mstuchli, rkuska, spoore
Target Milestone: rcKeywords: TestBlocker
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: python-2.7.5-31.el7 Doc Type: Bug Fix
Doc Text:
Cause: load_cert_chain couldn't accept None as a argument for keyfile Consequence: function would fail with error TypeError: coercing to Unicode: need string or buffer, NoneType found Fix: make function load_cert_chain accept None as a keyfile argument Result: load_cert_chain now accepts None as a keyfile argument
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 12:43:31 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1248675    

Description Christian Heimes 2015-08-05 14:49:42 UTC
Description of problem:
The backport of SSLContext to Python 2.7.5 has a bug in load_cert_chain() method. In vanilla Python 2.7.9 and 3.x the second argument to load_cert_chain() is optional and can also be set to None. However in RHEL's Python 2.7.5 None is not supported as second argument. This breaks requests and urllib3 with client cert authentication.

Version-Release number of selected component (if applicable):
Python 2.7.5

How reproducible:
You can reproduce the issue without a cert and key file. Both calls to load_cert_chain() should raise an IOError, because the cert doesn't exist.

>>> import ssl
>>> ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
>>> ctx.load_cert_chain('/does/not/exist', None)
>>> ctx.load_cert_chain('/does/not/exist')

Actual results:
>>> ctx.load_cert_chain('/does/not/exist', None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: coercing to Unicode: need string or buffer, NoneType found


Expected results:
>>> ctx.load_cert_chain('/does/not/exist', None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IOError: [Errno 2] No such file or directory
>>> ctx.load_cert_chain('/does/not/exist')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IOError: [Errno 2] No such file or directory

Additional info:
See https://hg.python.org/cpython/file/648dcafa7e5f/Modules/_ssl.c#l2461 how Python 2.7.9 handles the key file argument.

Comment 4 Scott Poore 2015-08-07 16:16:18 UTC
FYI, I just tested on an IPA server.  It looks like this issues I was seeing are resolved.

[root@master ~]# rpm -q python
python-2.7.5-31.el7.x86_64


[root@master ~]# python
Python 2.7.5 (default, Aug  6 2015, 10:12:10) 
[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
>>> ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1)internal error has
>>> ctx.load_cert_chain('/does/not/exist', None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IOError: [Errno 2] No such file or directory
>>> ctx.load_cert_chain('/does/not/exist')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IOError: [Errno 2] No such file or directory
>>> 

And the actual place I was seeing the issue on IPA:

[root@master ~]# ipa vault-add MyVault01 --password=Secret123
-----------------------
Added vault "MyVault01"
-----------------------
  Vault name: MyVault01
  Type: standard
  Owner users: admin

Previously I was seeing the internal error as shown in the IPA bug this was blocking.

Thanks,
Scott

Comment 6 errata-xmlrpc 2015-11-19 12:43:31 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.

https://rhn.redhat.com/errata/RHSA-2015-2101.html