python-etcd icon indicating copy to clipboard operation
python-etcd copied to clipboard

Connection to etcd failed due to SSLError

Open halcyonone opened this issue 7 years ago • 7 comments

I use ssl connect to etcd server, the error is etcd.EtcdConnectionFailed: Connection to etcd failed due to SSLError(SSLError(1, u'[SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590)'),)

my etcd server version is 3.1.3, python-etcd version is 0.4.5, please help me, thx.

halcyonone avatar Mar 20 '17 07:03 halcyonone

Had the same issue here, Is there a way to skip SSL verification?

cizixs avatar Apr 25 '17 02:04 cizixs

I'm using etcd ssl connect too. Can you show your code in connect to etcd with etcd.Client()? Thank you very much!

yejw5 avatar May 18 '17 10:05 yejw5

Fix -- force TLS1.2 (this will error if your python doesn't support it)

import etcd
import ssl
c = etcd.Client(host='localhost', port=2379, cert=('/certs/cert', '/certs/key'), ca_cert='/certs/ca_cert', protocol='https')
c.http.connection_pool_kw['ssl_version'] = ssl.PROTOCOL_TLSv1_2  

ColinChartier avatar Jun 15 '17 02:06 ColinChartier

@ColinChartier I like your patch, although I'm thinking we should just go with TLS 1.2 by default on any python version that supports it. Maybe drop support for any pyopenssl version that doesn't?

lavagetto avatar Jun 17 '17 10:06 lavagetto

@lavagetto I'm not actually sure which ETCD versions support which encryption versions -- I know for sure that you will alienate a lot of python 2 folks on Mac at least if you do that.

The problem is that python itself needs to be recompiled with the specific openssl version, unless you use PyOpenSSL or whatever, and that is a huge hassle in general.

ColinChartier avatar Jun 18 '17 17:06 ColinChartier

Also-- I upgraded python-etcd after the patch that removed forced TLS1.1 in the constructor and everything is working for me (this issue no longer presents), so I suppose that newer ETCD servers only accept TLS1.2. You could give a more descriptive error message if negotiation fails and the TLSv1_2 constant is unset in ssl.py

ColinChartier avatar Jun 18 '17 17:06 ColinChartier

I have the same problem , who can help me?

hanhailin avatar Mar 24 '18 02:03 hanhailin