diff options
author | Christian Heimes <christian@python.org> | 2018-01-27 14:51:38 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-27 14:51:38 (GMT) |
commit | 61d478c71c5341cdc54e6bfb4ace4252852fd972 (patch) | |
tree | 5ad17242b4c341df03664ee5cde87cdb80b0ee50 /Lib/test/test_imaplib.py | |
parent | 746cc75541f31278864a10b995e7d009bd2ff053 (diff) | |
download | cpython-61d478c71c5341cdc54e6bfb4ace4252852fd972.zip cpython-61d478c71c5341cdc54e6bfb4ace4252852fd972.tar.gz cpython-61d478c71c5341cdc54e6bfb4ace4252852fd972.tar.bz2 |
bpo-31399: Let OpenSSL verify hostname and IP address (#3462)
bpo-31399: Let OpenSSL verify hostname and IP
The ssl module now uses OpenSSL's X509_VERIFY_PARAM_set1_host() and
X509_VERIFY_PARAM_set1_ip() API to verify hostname and IP addresses.
* Remove match_hostname calls
* Check for libssl with set1_host, libssl must provide X509_VERIFY_PARAM_set1_host()
* Add documentation for OpenSSL 1.0.2 requirement
* Don't support OpenSSL special mode with a leading dot, e.g. ".example.org" matches "www.example.org". It's not standard conform.
* Add hostname_checks_common_name
Signed-off-by: Christian Heimes <christian@python.org>
Diffstat (limited to 'Lib/test/test_imaplib.py')
-rw-r--r-- | Lib/test/test_imaplib.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/test/test_imaplib.py b/Lib/test/test_imaplib.py index 4a45be6..f16bacd 100644 --- a/Lib/test/test_imaplib.py +++ b/Lib/test/test_imaplib.py @@ -485,7 +485,8 @@ class NewIMAPSSLTests(NewIMAPTestsMixin, unittest.TestCase): ssl_context.load_verify_locations(CAFILE) with self.assertRaisesRegex(ssl.CertificateError, - "hostname '127.0.0.1' doesn't match 'localhost'"): + "IP address mismatch, certificate is not valid for " + "'127.0.0.1'"): _, server = self._setup(SimpleIMAPHandler) client = self.imap_class(*server.server_address, ssl_context=ssl_context) @@ -874,7 +875,8 @@ class ThreadedNetworkedTestsSSL(ThreadedNetworkedTests): with self.assertRaisesRegex( ssl.CertificateError, - "hostname '127.0.0.1' doesn't match 'localhost'"): + "IP address mismatch, certificate is not valid for " + "'127.0.0.1'"): with self.reaped_server(SimpleIMAPHandler) as server: client = self.imap_class(*server.server_address, ssl_context=ssl_context) |