mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
bpo-32947: OpenSSL 1.1.1-pre1 / TLS 1.3 fixes (GH-5663)
* bpo-32947: OpenSSL 1.1.1-pre1 / TLS 1.3 fixes
Misc fixes and workarounds for compatibility with OpenSSL 1.1.1-pre1 and
TLS 1.3 support. With OpenSSL 1.1.1, Python negotiates TLS 1.3 by
default. Some test cases only apply to TLS 1.2. Other tests currently
fail because the threaded or async test servers stop after failure.
I'm going to address these issues when OpenSSL 1.1.1 reaches beta.
OpenSSL 1.1.1 has added a new option OP_ENABLE_MIDDLEBOX_COMPAT for TLS
1.3. The feature is enabled by default for maximum compatibility with
broken middle boxes. Users should be able to disable the hack and CPython's test suite needs
it to verify default options.
Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit 05d9fe32a1
)
Co-authored-by: Christian Heimes <christian@python.org>
This commit is contained in:
parent
a93e3dc236
commit
2614ed4c6e
9 changed files with 129 additions and 72 deletions
|
@ -153,6 +153,8 @@ class DummyPOP3Handler(asynchat.async_chat):
|
|||
if self.tls_active is False:
|
||||
self.push('+OK Begin TLS negotiation')
|
||||
context = ssl.SSLContext()
|
||||
# TODO: fix TLSv1.3 support
|
||||
context.options |= ssl.OP_NO_TLSv1_3
|
||||
context.load_cert_chain(CERTFILE)
|
||||
tls_sock = context.wrap_socket(self.socket,
|
||||
server_side=True,
|
||||
|
@ -356,6 +358,8 @@ class TestPOP3Class(TestCase):
|
|||
def test_stls_context(self):
|
||||
expected = b'+OK Begin TLS negotiation'
|
||||
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
|
||||
# TODO: fix TLSv1.3 support
|
||||
ctx.options |= ssl.OP_NO_TLSv1_3
|
||||
ctx.load_verify_locations(CAFILE)
|
||||
self.assertEqual(ctx.verify_mode, ssl.CERT_REQUIRED)
|
||||
self.assertEqual(ctx.check_hostname, True)
|
||||
|
@ -396,6 +400,8 @@ class TestPOP3_SSLClass(TestPOP3Class):
|
|||
|
||||
def test_context(self):
|
||||
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
|
||||
# TODO: fix TLSv1.3 support
|
||||
ctx.options |= ssl.OP_NO_TLSv1_3
|
||||
ctx.check_hostname = False
|
||||
ctx.verify_mode = ssl.CERT_NONE
|
||||
self.assertRaises(ValueError, poplib.POP3_SSL, self.server.host,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue