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 1450213 - python-urllib3 possibly not up to date in EL repo - SSL error with default ca cert path
Summary: python-urllib3 possibly not up to date in EL repo - SSL error with default ca...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: python-urllib3
Version: 7.3
Hardware: noarch
OS: Linux
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Python Maintainers
QA Contact: Anna Khaitovich
URL:
Whiteboard:
Depends On:
Blocks: 1465891
TreeView+ depends on / blocked
 
Reported: 2017-05-11 20:52 UTC by Shreyas Bhat
Modified: 2018-04-10 11:45 UTC (History)
7 users (show)

Fixed In Version: python-urllib3-1.10.2-4.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-10 11:45:16 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Test script to demonstrate bug (127 bytes, text/plain)
2017-05-11 20:52 UTC, Shreyas Bhat
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:0731 0 None None None 2018-04-10 11:45:34 UTC

Description Shreyas Bhat 2017-05-11 20:52:47 UTC
Created attachment 1278018 [details]
Test script to demonstrate bug

Description of problem:

I believe the python-urllib3 rpm that is in the EL7 repo is an old version, and it has a bug with regards to HTTPS connections. The bug is that the python urllib3 library's connectionpool.py module defaults the variable ca_certs, where it looks for the CA certs, to /etc/ssl/certs/ca-certificates.crt, which isn't the default for RHEL-based distributions, I believe. So if I try to connect to, say, https://www.google.com without specifying a cert, it will throw an SSLError. This is not the case with the version of urllib3 in PyPI, where you'll only get a warning, and no error. The difference is that in the latter, the default for ca_certs is None, so not specifying a location will not cause the python code to fail. Given that the error appears in the EL package and not in the PyPI one, I'm assuming the latter is older.

I've put more details on how I reproduced the error below.


Version-Release number of selected component (if applicable):
1.10.2-2

How reproducible:
100%

Steps to Reproduce:
1. yum install python-urllib3
2. Run python script testscript.py, that simply tries to connect to https://www.google.com without specifying a ca cert bundle.

Actual results:
Here is the error I get:

Traceback (most recent call last):
File "testscript.py", line 4, in <module>
r = http.request('GET', 'https://www.google.com')
File "/usr/lib/python2.7/site-packages/urllib3/request.py", line 68, in request
**urlopen_kw)
File "/usr/lib/python2.7/site-packages/urllib3/request.py", line 81, in request_encode_url
return self.urlopen(method, url, **urlopen_kw)
File "/usr/lib/python2.7/site-packages/urllib3/poolmanager.py", line 161, in urlopen
response = conn.urlopen(method, u.request_uri, **kw)
File "/usr/lib/python2.7/site-packages/urllib3/connectionpool.py", line 544, in urlopen
body=body, headers=headers)
File "/usr/lib/python2.7/site-packages/urllib3/connectionpool.py", line 341, in _make_request
self._validate_conn(conn)
File "/usr/lib/python2.7/site-packages/urllib3/connectionpool.py", line 762, in _validate_conn
conn.connect()
File "/usr/lib/python2.7/site-packages/urllib3/connection.py", line 238, in connect
ssl_version=resolved_ssl_version)
File "/usr/lib/python2.7/site-packages/urllib3/util/ssl_.py", line 246, in ssl_wrap_socket
raise SSLError(e)
urllib3.exceptions.SSLError: [Errno 2] No such file or directory 


Expected results:
In the PyPI version I installed with pip, I got the following warning, but no error:

/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:852: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
200
Success 


Additional info:
I've attached my test script to this bug report.

Comment 2 Charalampos Stratakis 2017-07-04 12:55:44 UTC
Hello.

You are correct in that. The correct path for RHEL for the certificates should be "/etc/ssl/certs/ca-bundle.crt", however urllib3 searches at "/etc/ssl/certs/ca-certificates.crt"

This is due to a downstream modification for bug 855320 , however when the path changed [0], the fix for it did not propagate into RHEL.

This is easy to test it as well. You can go to /usr/lib/python2.7/site-packages/urllib3 , remove the connectionpool.pyc and .pyo files and modify the lines at connectionpool.py as indicated by [0].

Your script should work by then.

[0] http://pkgs.fedoraproject.org/cgit/rpms/python-urllib3.git/commit/?id=4670672fa3bc24459a1a4468ab073a102f4d4a1c

Comment 9 errata-xmlrpc 2018-04-10 11:45:16 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/RHBA-2018:0731


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