From: Benjamin Braatz Date: Wed, 12 Jun 2024 10:20:50 +0000 (+0200) Subject: Fix TLS error (disable verifications) X-Git-Url: http://git.graph-it.com/?a=commitdiff_plain;h=e75bc06948e15c187c3e86053bab55e98710baee;p=graphit%2Fgraph-client-py.git Fix TLS error (disable verifications) --- diff --git a/graph/connection_raw.py b/graph/connection_raw.py index 4349844..abd535e 100644 --- a/graph/connection_raw.py +++ b/graph/connection_raw.py @@ -1,6 +1,6 @@ from collections import OrderedDict from socket import socket, AF_UNIX, AF_INET, SOCK_STREAM -from ssl import SSLContext, PROTOCOL_TLSv1 +from ssl import SSLContext, PROTOCOL_TLS_CLIENT, CERT_NONE from struct import pack, unpack try: from urllib.parse import urlparse @@ -30,7 +30,9 @@ class RawConnection: self.__sock = socket(AF_INET, SOCK_STREAM) self.__sock.connect((res.hostname, res.port)) if res.scheme == 'tls': - ssl_ctx = SSLContext(PROTOCOL_TLSv1) + ssl_ctx = SSLContext(PROTOCOL_TLS_CLIENT) + ssl_ctx.check_hostname = False + ssl_ctx.verify_mode = CERT_NONE ssl_ctx.load_cert_chain(self.__crt_filename) self.__sock = socket(AF_INET, SOCK_STREAM) self.__sock = ssl_ctx.wrap_socket(self.__sock)