Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1364444 - Python fails to decode X.509 cert with GEN_RID subject alt name
Summary: Python fails to decode X.509 cert with GEN_RID subject alt name
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: python
Version: 7.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Charalampos Stratakis
QA Contact: Branislav Náter
URL:
Whiteboard:
Depends On:
Blocks: 1380359 1393868
TreeView+ depends on / blocked
 
Reported: 2016-08-05 11:09 UTC by Christian Heimes
Modified: 2017-08-01 20:25 UTC (History)
4 users (show)

Fixed In Version: python-2.7.5-49.el7
Doc Type: No Doc Update
Doc Text:
undefined
Clone Of:
: 1402154 (view as bug list)
Environment:
Last Closed: 2017-08-01 20:25:03 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2017:1868 normal SHIPPED_LIVE Moderate: python security and bug fix update 2017-08-01 18:24:21 UTC
Python 27691 None None None 2016-08-08 09:04:29 UTC

Description Christian Heimes 2016-08-05 11:09:35 UTC
Description of problem:
Python fails to decode X.509 certificate with a GEN_RID general name in subject alternative names. The problem makes it impossible to verify that a server certificate matches a host name. On the other hand registered id are required for SearchGuard 2.x with Elasticsearch 2.x. #1364268 has more information.

Version-Release number of selected component (if applicable):
All versions of Python in RHEL and Fedora are affected.

How reproducible:
The bug can be reproduced with any certificate that has a registered id (GEN_RID) in the X509v3 subject alt name extension.

Steps to Reproduce:
1. Download rid.pem from https://bugs.python.org/issue27691
2. python -c "import _ssl; print(_ssl._test_decode_cert('rid.pem'))"

Actual results:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
SystemError: error return without exception set

Expected results:
{'OCSP': ('http://acme.test/ca/ocsp/tls-server-ca',), 'serialNumber': '01', 'crlDistributionPoints': ('http://acme.test/ca/tls-server-ca.crl',), 'version': 3, 'caIssuers': ('http://acme.test/ca/tls-server-ca.cer',), 'notAfter': 'Aug  5 09:13:13 2018 GMT', 'subjectAltName': (('Registered ID', '1.2.3.4.5.5'), ('DNS', 'localhost'), ('IP Address', '127.0.0.1'), ('IP Address', '0:0:0:0:0:0:0:1\n')), 'subject': ((('countryName', 'XX'),), (('organizationName', 'Acme Corp'),), (('organizationalUnitName', 'Acme Users'),), (('commonName', 'localhost'),)), 'issuer': ((('countryName', 'XX'),), (('organizationName', 'Acme Corp'),), (('organizationalUnitName', 'Acme Certificate Authority'),), (('commonName', 'Acme TLS Server CA'),)), 'notBefore': 'Aug  5 09:13:13 2016 GMT'}


Additional info:
The root cause of the Python bug is a bug in OpenSSL's GENERAL_NAME_print() function, see #1364268. The ticket on Python's bug tracker has a fix with unit tests.

Comment 2 Petr Viktorin 2016-08-08 09:04:29 UTC
Fixing Python tracker ID.

I plan to add devel_ack as soon as the patch is upstream.

Comment 5 Branislav Náter 2017-04-26 12:21:41 UTC
Reproduced on python-2.7.5-48.el7:

:: [  BEGIN   ] :: Running 'python -c "import _ssl; print(_ssl._test_decode_cert('rid.pem'))"'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
SystemError: error return without exception set
:: [   FAIL   ] :: Command 'python -c "import _ssl; print(_ssl._test_decode_cert('rid.pem'))"' (Expected 0, got 1)

Verified on python-2.7.5-57.el7:
Python is able to decode certificate that has a registered id (GEN_RID) in the X509v3 subject alt name extension.

:: [  BEGIN   ] :: Running 'python -c "import _ssl; print(_ssl._test_decode_cert('rid.pem'))"'
{'crlDistributionPoints': (u'http://acme.test/ca/tls-server-ca.crl',), 'subjectAltName': ((u'Registered ID', u'1.2.3.4.5.5'), ('DNS', 'localhost'), ('IP Address', '127.0.0.1'), ('IP Address', '0:0:0:0:0:0:0:1\n')), 'notBefore': u'Aug  5 09:13:13 2016 GMT', 'caIssuers': (u'http://acme.test/ca/tls-server-ca.cer',), 'OCSP': (u'http://acme.test/ca/ocsp/tls-server-ca',), 'serialNumber': u'01', 'notAfter': 'Aug  5 09:13:13 2018 GMT', 'version': 3L, 'subject': ((('countryName', u'XX'),), (('organizationName', u'Acme Corp'),), (('organizationalUnitName', u'Acme Users'),), (('commonName', u'localhost'),)), 'issuer': ((('countryName', u'XX'),), (('organizationName', u'Acme Corp'),), (('organizationalUnitName', u'Acme Certificate Authority'),), (('commonName', u'Acme TLS Server CA'),))}
:: [   PASS   ] :: Command 'python -c "import _ssl; print(_ssl._test_decode_cert('rid.pem'))"' (Expected 0, got 0)

Comment 6 errata-xmlrpc 2017-08-01 20:25:03 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://access.redhat.com/errata/RHSA-2017:1868


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