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
{{ message }}
Repository navigation
test_ssl fails on RHEL8 strict OpenSSL configuration #80218
RHEL8 uses a strict crypto policy by default. For example, SSLContext uses TLS 1.2 as the minimum version by default.
Attached PR fix test_ssl for RHEL8. The PR is not specific to RHEL8. It should also fix test_ssl on Debian: see bpo-35925 and bpo-36005.
test_ssl failures on RHEL8:
======================================================================
ERROR: test_PROTOCOL_TLS (test.test_ssl.ThreadedTests)
Connecting to an SSLv23 server with various client options
----------------------------------------------------------------------
Traceback (most recent call last):
File "/root/cpython-master/Lib/test/test_ssl.py", line 3079, in test_PROTOCOL_TLS
try_protocol_combo(ssl.PROTOCOL_TLS, ssl.PROTOCOL_TLSv1, 'TLSv1')
File "/root/cpython-master/Lib/test/test_ssl.py", line 2623, in try_protocol_combo
stats = server_params_test(client_context, server_context,
File "/root/cpython-master/Lib/test/test_ssl.py", line 2549, in server_params_test
s.connect((HOST, server.port))
File "/root/cpython-master/Lib/ssl.py", line 1150, in connectself._real_connect(addr, False)
File "/root/cpython-master/Lib/ssl.py", line 1141, in _real_connectself.do_handshake()
File "/root/cpython-master/Lib/ssl.py", line 1117, in do_handshakeself._sslobj.do_handshake()
ssl.SSLError: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:1055)
======================================================================
ERROR: test_protocol_tlsv1_1 (test.test_ssl.ThreadedTests)
Connecting to a TLSv1.1 server with various client options.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/root/cpython-master/Lib/test/test_ssl.py", line 3150, in test_protocol_tlsv1_1
try_protocol_combo(ssl.PROTOCOL_TLS, ssl.PROTOCOL_TLSv1_1, 'TLSv1.1')
File "/root/cpython-master/Lib/test/test_ssl.py", line 2623, in try_protocol_combo
stats = server_params_test(client_context, server_context,
File "/root/cpython-master/Lib/test/test_ssl.py", line 2549, in server_params_test
s.connect((HOST, server.port))
File "/root/cpython-master/Lib/ssl.py", line 1150, in connectself._real_connect(addr, False)
File "/root/cpython-master/Lib/ssl.py", line 1141, in _real_connectself.do_handshake()
File "/root/cpython-master/Lib/ssl.py", line 1117, in do_handshakeself._sslobj.do_handshake()
ssl.SSLError: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:1055)
Traceback (most recent call last):
File "/root/cpython-master/Lib/test/test_ssl.py", line 1093, in test_min_max_versionself.assertIn(
AssertionError: <TLSVersion.TLSv1_2: 771> not found in {<TLSVersion.TLSv1: 769>, <TLSVersion.MINIMUM_SUPPORTED: -2>}
... But right now, Python 2.7 doesn't give access to minimum_version/maximum_version :-( Not even to read these versions. So I'm not sure how to skip or fix these tests, without backporting code for these attributes.
RHEL8 uses a strict crypto policy by default. For example, SSLContext uses TLS 1.2 as the minimum version by default.
Ah, I forgot to mention that a workaround is to use OPENSSL_CONF=/ environment variable to ignore RHEL crypto policy (don't load system OpenSSL configuration).
Python 2.7 and 3.6 have no SSLContext.minimum_version attribute (even with OpenSSL 1.1.1). I think that we will workaround this issue in Fedora and RHEL8 spec file (recipe to build RPM packages) using "export OPENSSL_CONF=/non-existing-file".
Activity
vstinner commentedon Feb 19, 2019
RHEL8 uses a strict crypto policy by default. For example, SSLContext uses TLS 1.2 as the minimum version by default.
Attached PR fix test_ssl for RHEL8. The PR is not specific to RHEL8. It should also fix test_ssl on Debian: see bpo-35925 and bpo-36005.
test_ssl failures on RHEL8:
======================================================================
ERROR: test_PROTOCOL_TLS (test.test_ssl.ThreadedTests)
Connecting to an SSLv23 server with various client options
----------------------------------------------------------------------
======================================================================
ERROR: test_protocol_tlsv1_1 (test.test_ssl.ThreadedTests)
Connecting to a TLSv1.1 server with various client options.
----------------------------------------------------------------------
======================================================================
FAIL: test_min_max_version (test.test_ssl.ContextTests)
----------------------------------------------------------------------
Ran 150 tests in 3.318s
FAILED (failures=1, errors=2, skipped=9)
vstinner commentedon Feb 19, 2019
On Python 2.7.16rc, similar tests are failing on RHEL8:
ERROR: test_protocol_sslv23 (test.test_ssl.ThreadedTests)
ERROR: test_protocol_tlsv1_1 (test.test_ssl.ThreadedTests)
... But right now, Python 2.7 doesn't give access to minimum_version/maximum_version :-( Not even to read these versions. So I'm not sure how to skip or fix these tests, without backporting code for these attributes.
vstinner commentedon Feb 19, 2019
Ah, I forgot to mention that a workaround is to use OPENSSL_CONF=/ environment variable to ignore RHEL crypto policy (don't load system OpenSSL configuration).
vstinner commentedon Feb 19, 2019
Python 2.7 and 3.6 have no SSLContext.minimum_version attribute (even with OpenSSL 1.1.1). I think that we will workaround this issue in Fedora and RHEL8 spec file (recipe to build RPM packages) using "export OPENSSL_CONF=/non-existing-file".
vstinner commentedon Feb 19, 2019
New changeset 3ef6344 by Victor Stinner in branch 'master':
bpo-36037: Fix test_ssl for strict OpenSSL policy (GH-11940)
3ef6344
miss-islington commentedon Feb 19, 2019
New changeset e8bf04d by Miss Islington (bot) in branch '3.7':
bpo-36037: Fix test_ssl for strict OpenSSL policy (GH-11940)
e8bf04d
vstinner commentedon Feb 19, 2019
Ok, Python 3.7 and 3.8 (master) have been fixed.
See bpo-35925 (and bpo-36005) for discussions on Python 2.7 and 3.6.