Erlend E. Aasland <erlend.aasl...@innova.no> added the comment:

I can reproduce these issues easily on 3.7, 3.8, and 3.9:

$ python3.7 -m test test_ssl -u all -F -m test_get_server_certificate -v
[...]
test_get_server_certificate (test.test_ssl.SimpleBackgroundTests) ...  server:  
new connection from ('127.0.0.1', 57294)

 server:  bad connection attempt from ('127.0.0.1', 57294):
Traceback (most recent call last):
   File "/Users/erlendaasland/install/lib/python3.7/test/test_ssl.py", line 
2313, in wrap_conn
    self.sock, server_side=True)
   File "/Users/erlendaasland/install/lib/python3.7/ssl.py", line 423, in 
wrap_socket
    session=session
   File "/Users/erlendaasland/install/lib/python3.7/ssl.py", line 870, in 
_create
    self.do_handshake()
   File "/Users/erlendaasland/install/lib/python3.7/ssl.py", line 1139, in 
do_handshake
    self._sslobj.do_handshake()
 OSError: [Errno 41] Protocol wrong type for socket
ERROR

======================================================================
ERROR: test_get_server_certificate (test.test_ssl.SimpleBackgroundTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/erlendaasland/install/lib/python3.7/test/test_ssl.py", line 
2108, in test_get_server_certificate
    _test_get_server_certificate(self, *self.server_addr, cert=SIGNING_CA)
  File "/Users/erlendaasland/install/lib/python3.7/test/test_ssl.py", line 
2273, in _test_get_server_certificate
    pem = ssl.get_server_certificate((host, port), ca_certs=cert)
  File "/Users/erlendaasland/install/lib/python3.7/ssl.py", line 1313, in 
get_server_certificate
    with  create_connection(addr) as sock:
  File "/Users/erlendaasland/install/lib/python3.7/socket.py", line 728, in 
create_connection
    raise err
  File "/Users/erlendaasland/install/lib/python3.7/socket.py", line 716, in 
create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 61] Connection refused


$ python3.8 -m test test_ssl -u all -F -m test_get_server_certificate -v
test_ssl: testing with 'OpenSSL 1.1.1k  25 Mar 2021' (1, 1, 1, 11, 15)
          under Mac ('10.16', ('', '', ''), 'x86_64')
          HAS_SNI = True
          OP_ALL = 0x80000054
          OP_NO_TLSv1_1 = 0x10000000
test_get_server_certificate (test.test_ssl.SimpleBackgroundTests) ...  server:  
new connection from ('127.0.0.1', 59370)

 server:  bad connection attempt from ('127.0.0.1', 59370):
Traceback (most recent call last):
   File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/test/test_ssl.py",
 line 2348, in wrap_conn
    self.sslconn = self.server.context.wrap_socket(
   File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py", line 
500, in wrap_socket
    return self.sslsocket_class._create(
   File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py", line 
1040, in _create
    self.do_handshake()
   File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py", line 
1309, in do_handshake
    self._sslobj.do_handshake()
 OSError: [Errno 41] Protocol wrong type for socket
ERROR

======================================================================
ERROR: test_get_server_certificate (test.test_ssl.SimpleBackgroundTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/test/test_ssl.py",
 line 2142, in test_get_server_certificate
    _test_get_server_certificate(self, *self.server_addr, cert=SIGNING_CA)
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/test/test_ssl.py",
 line 2309, in _test_get_server_certificate
    pem = ssl.get_server_certificate((host, port), ca_certs=cert)
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py", line 
1484, in get_server_certificate
    with context.wrap_socket(sock) as sslsock:
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py", line 
500, in wrap_socket
    return self.sslsocket_class._create(
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py", line 
1040, in _create
    self.do_handshake()
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py", line 
1309, in do_handshake
    self._sslobj.do_handshake()
ConnectionResetError: [Errno 54] Connection reset by peer


$ python3.9 -m test test_ssl -u all -F -m test_get_server_certificate -v
[...]
test_ssl: testing with 'OpenSSL 1.1.1k  25 Mar 2021' (1, 1, 1, 11, 15)
          under Mac ('10.16', ('', '', ''), 'x86_64')
          HAS_SNI = True
          OP_ALL = 0x80000054
          OP_NO_TLSv1_1 = 0x10000000
test_get_server_certificate (test.test_ssl.SimpleBackgroundTests) ...  server:  
new connection from ('127.0.0.1', 60096)

 server:  bad connection attempt from ('127.0.0.1', 60096):
Traceback (most recent call last):
   File 
"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/test/test_ssl.py",
 line 2353, in wrap_conn
    self.sslconn = self.server.context.wrap_socket(
   File 
"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py", line 
500, in wrap_socket
    return self.sslsocket_class._create(
   File 
"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py", line 
1040, in _create
    self.do_handshake()
   File 
"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py", line 
1309, in do_handshake
    self._sslobj.do_handshake()
 OSError: [Errno 41] Protocol wrong type for socket
ERROR

======================================================================
ERROR: test_get_server_certificate (test.test_ssl.SimpleBackgroundTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File 
"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/test/test_ssl.py",
 line 2147, in test_get_server_certificate
    _test_get_server_certificate(self, *self.server_addr, cert=SIGNING_CA)
  File 
"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/test/test_ssl.py",
 line 2314, in _test_get_server_certificate
    pem = ssl.get_server_certificate((host, port), ca_certs=cert)
  File 
"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py", line 
1484, in get_server_certificate
    with context.wrap_socket(sock) as sslsock:
  File 
"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py", line 
500, in wrap_socket
    return self.sslsocket_class._create(
  File 
"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py", line 
1040, in _create
    self.do_handshake()
  File 
"/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py", line 
1309, in do_handshake
    self._sslobj.do_handshake()
ConnectionResetError: [Errno 54] Connection reset by peer


It does not seem to be specific to 3.10/3.11.

----------
versions: +Python 3.10, Python 3.8, Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44229>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to