Resolve an SSL issue when connecting to PyBitmessage 0.6.1, log version

This commit is contained in:
Lee Miller 2023-09-18 00:47:23 +03:00
parent fe508c176b
commit 16de8d1ae4
Signed by untrusted user: lee.miller
GPG Key ID: 4F97A5EA88F4AB63
1 changed files with 7 additions and 2 deletions

View File

@ -207,6 +207,11 @@ class Connection(threading.Thread):
context.options = (
ssl.OP_ALL | ssl.OP_NO_SSLv2 | ssl.OP_NO_SSLv3
| ssl.OP_SINGLE_ECDH_USE | ssl.OP_CIPHER_SERVER_PREFERENCE)
# OP_NO_SSL* is deprecated since 3.6
try:
context.minimum_version = ssl.TLSVersion.TLSv1
except AttributeError:
pass
self.s = context.wrap_socket(
self.s, server_side=self.server, do_handshake_on_connect=False)
@ -227,8 +232,8 @@ class Connection(threading.Thread):
break
self.tls = True
logging.debug(
'Established TLS connection with %s:%s',
self.host_print, self.port)
'Established TLS connection with %s:%s (%s)',
self.host_print, self.port, self.s.version())
def _send_message(self, m):
if isinstance(m, message.Message) and m.command == b'object':