You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A good reason to use backports.ssl is that it makes correct SNI and match_hostname support available to python programs running on RHEL 7 or CentOS 7. These OSes ship with python 2.7.5, and this support was only added into mainstream python in 2.7.9.
However, it turns out that match_hostname silently fails to decode subject_alt_name extension records if the subject_alt_name import fails:
try:
from .subject_alt_name import get_subject_alt_name
except ImportError:
get_subject_alt_name = None
This can happen, for example, if the pyasn1 library (python-pyasn1 RPM) isn't installed.
The net effect is that match_hostname erroneously fails, e.g. against domains such as pypi.python.org, which is listed as a SAN.
My RFE is that if match_hostname is being used, it should fail as early as possible if subject_alt_name isn't available.
On CentOS 7 / RHEL 7, if python-pyasn1 is available, this test case works fine. If not, you get the error:
Traceback (most recent call last):
File "test.py", line 25, in <module>
s = clientctx.wrap_socket(s, server_hostname=d)
File "/usr/lib/python2.7/site-packages/backports/ssl/core.py", line 669, in wrap_socket
self.check_hostname)
File "/usr/lib/python2.7/site-packages/backports/ssl/core.py", line 241, in __init__
self.do_handshake()
File "/usr/lib/python2.7/site-packages/backports/ssl/core.py", line 263, in do_handshake
match_hostname(self.getpeercert(), self._conn.get_servername().decode('utf-8'))
File "/usr/lib/python2.7/site-packages/backports/ssl/core.py", line 184, in match_hostname
% (hostname, dnsnames[0]))
backports.ssl.core.CertificateError: hostname u'pypi.python.org' doesn't match u'www.python.org'
The text was updated successfully, but these errors were encountered:
A good reason to use backports.ssl is that it makes correct SNI and match_hostname support available to python programs running on RHEL 7 or CentOS 7. These OSes ship with python 2.7.5, and this support was only added into mainstream python in 2.7.9.
However, it turns out that match_hostname silently fails to decode subject_alt_name extension records if the subject_alt_name import fails:
This can happen, for example, if the pyasn1 library (python-pyasn1 RPM) isn't installed.
The net effect is that match_hostname erroneously fails, e.g. against domains such as pypi.python.org, which is listed as a SAN.
My RFE is that if match_hostname is being used, it should fail as early as possible if subject_alt_name isn't available.
Here's a test case:
On CentOS 7 / RHEL 7, if python-pyasn1 is available, this test case works fine. If not, you get the error:
The text was updated successfully, but these errors were encountered: