Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
bpo-44888: Add ssl.OP_LEGACY_SERVER_CONNECT#27776
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Uh oh!
There was an error while loading. Please reload this page.
Closed
Changes from all commits
Commits
Show all changes
7 commits Select commit Hold shift + click to select a range
3e14217 Add ssl.OP_LEGACY_SERVER_CONNECT
xtkoba 3170625 NEWS entry
xtkoba f07c086 Documentation
xtkoba 4cb5f3d Test case
xtkoba 832e67b Doc: availability
xtkoba 5891371 Test case: availability
xtkoba dc22a8c Test case: connection
xtkoba File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -157,6 +157,7 @@ def data_file(*name): | ||
| OP_CIPHER_SERVER_PREFERENCE = getattr(ssl, "OP_CIPHER_SERVER_PREFERENCE", 0) | ||
| OP_ENABLE_MIDDLEBOX_COMPAT = getattr(ssl, "OP_ENABLE_MIDDLEBOX_COMPAT", 0) | ||
| OP_IGNORE_UNEXPECTED_EOF = getattr(ssl, "OP_IGNORE_UNEXPECTED_EOF", 0) | ||
| OP_LEGACY_SERVER_CONNECT = getattr(ssl, "OP_LEGACY_SERVER_CONNECT", 0) | ||
tiran marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading. Please reload this page. | ||
| # Ubuntu has patched OpenSSL and changed behavior of security level 2 | ||
| # see https://bugs.python.org/issue41561#msg389003 | ||
| @@ -1191,6 +1192,9 @@ def test_options(self): | ||
| ctx.options = 0 | ||
| # Ubuntu has OP_NO_SSLv3 forced on by default | ||
| self.assertEqual(0, ctx.options & ~ssl.OP_NO_SSLv3) | ||
| # 0.9.8m or later | ||
| if ssl.OPENSSL_VERSION_INFO >= (0, 9, 8, 13, 15): | ||
| self.assertNotEqual(OP_LEGACY_SERVER_CONNECT, 0) | ||
| def test_verify_mode_protocol(self): | ||
| with warnings_helper.check_warnings(): | ||
| @@ -1681,6 +1685,12 @@ def _assert_context_options(self, ctx): | ||
| if OP_CIPHER_SERVER_PREFERENCE != 0: | ||
| self.assertEqual(ctx.options & OP_CIPHER_SERVER_PREFERENCE, | ||
| OP_CIPHER_SERVER_PREFERENCE) | ||
| if OP_LEGACY_SERVER_CONNECT != 0: | ||
| if IS_OPENSSL_3_0_0: | ||
| self.assertEqual(ctx.options & OP_LEGACY_SERVER_CONNECT, 0) | ||
| else: | ||
| self.assertEqual(ctx.options & OP_LEGACY_SERVER_CONNECT, | ||
| OP_LEGACY_SERVER_CONNECT) | ||
| def test_create_default_context(self): | ||
| ctx = ssl.create_default_context() | ||
| @@ -4073,6 +4083,18 @@ def test_compression_disabled(self): | ||
| sni_name=hostname) | ||
| self.assertIs(stats['compression'], None) | ||
| @unittest.skipUnless(hasattr(ssl, 'OP_LEGACY_SERVER_CONNECT'), | ||
| "ssl.OP_LEGACY_SERVER_CONNECT needed for this test") | ||
| def test_legacy_server_connect(self): | ||
| client_context, server_context, hostname = testing_context() | ||
| if IS_OPENSSL_3_0_0: | ||
| client_context.options |= ssl.OP_LEGACY_SERVER_CONNECT | ||
| else: | ||
| client_context.options &= ~ssl.OP_LEGACY_SERVER_CONNECT | ||
| stats = server_params_test(client_context, server_context, | ||
| chatty=True, connectionchatty=True, | ||
| sni_name=hostname) | ||
| @unittest.skipIf(Py_DEBUG_WIN32, "Avoid mixing debug/release CRT on Windows") | ||
| def test_dh_params(self): | ||
| # Check we can get a connection with ephemeral Diffie-Hellman | ||
1 change: 1 addition & 0 deletions 1 Misc/NEWS.d/next/Library/2021-08-18-05-14-36.bpo-44888.kpmYjl.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Add :data:`ssl.OP_LEGACY_SERVER_CONNECT` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.