Я получаю сообщение «[SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 Ошибка предупреждения квитирования (_ssl.c: 579)» во время квитирования ssl.Что мне здесь не хватает?Версия Python:
Python 2.7.5
Python использует:
>>> ssl.OPENSSL_VERSION
'OpenSSL 1.0.2k-fips 26 января 2017'
Вот мой код
sock = socket.socket()
sock.settimeout(2)
context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
context.verify_mode = ssl.CERT_REQUIRED
context.check_hostname = True
context.load_default_certs()
s = ssl.wrap_socket(sock,ssl_version=ssl.PROTOCOL_TLSv1_2, cert_reqs=ssl.CERT_REQUIRED, ca_certs="/etc/ssl/certs/ca-bundle.crt" )
hostStr = ("{host}:{port}").format(host=host,port=port)
try:
s.connect((host, port))
s.do_handshake()
checks.append({"host":hostStr,"canConnect":"true","canNegotiateSSL":"true"})
except ssl.SSLError as e:
error = ("Connectivity passed with SSL error: {error}").format(error=e)
if "CERTIFICATE_VERIFY_FAILED" not in error:
checks.append({"host":hostStr,"canConnect":"true","canNegotiateSSL":"false","message":error})
else:
checks.append({"host":hostStr,"canConnect":"false","canNegotiateSSL":"false","message":error})
except Exception as e:
error = ("Failed: {error}").format(error=e)
checks.append({"host":hostStr,"canConnect":"false","canNegotiateSSL":"false","message":error})
logging.debug(error)
finally:
s.close()