Skip to content

Got SSLCertVerificationError even I set the verify=False #116

@luzcn

Description

@luzcn

I'm using Presto-python-client version 0.8.2 in Jupyter notebook. I followed the example to create the connection and manually set the conn._http_session.verify = False, but I still got the SSLCertVerificationError.

conn = prestodb.dbapi.connect(
    host='remote server DNS', # public IP of Hunt EMR master node
    port=8446, # Port of Presto
    catalog='hive',
    user='zheng.lu',
    schema='prod_srctypes',
    http_scheme='https'
)

conn._http_session.verify = False
cur = conn.cursor()

cur.execute('show columns from v_bro')

I'm using Python 3.7, please help to fix it.

The exception trace

---------------------------------------------------------------------------
SSLCertVerificationError                  Traceback (most recent call last)
/opt/sfdc/python37/lib/python3.7/site-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
    709                 headers=headers,
--> 710                 chunked=chunked,
    711             )

/opt/sfdc/python37/lib/python3.7/site-packages/urllib3/connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
    385         try:
--> 386             self._validate_conn(conn)
    387         except (SocketTimeout, BaseSSLError) as e:

/opt/sfdc/python37/lib/python3.7/site-packages/urllib3/connectionpool.py in _validate_conn(self, conn)
   1039         if not getattr(conn, "sock", None):  # AppEngine might not have  `.sock`
-> 1040             conn.connect()
   1041 

/opt/sfdc/python37/lib/python3.7/site-packages/urllib3/connection.py in connect(self)
    423             ssl_context=context,
--> 424             tls_in_tls=tls_in_tls,
    425         )

/opt/sfdc/python37/lib/python3.7/site-packages/urllib3/util/ssl_.py in ssl_wrap_socket(sock, keyfile, certfile, cert_reqs, ca_certs, server_hostname, ssl_version, ciphers, ssl_context, ca_cert_dir, key_password, ca_cert_data, tls_in_tls)
    449         ssl_sock = _ssl_wrap_socket_impl(
--> 450             sock, context, tls_in_tls, server_hostname=server_hostname
    451         )

/opt/sfdc/python37/lib/python3.7/site-packages/urllib3/util/ssl_.py in _ssl_wrap_socket_impl(sock, ssl_context, tls_in_tls, server_hostname)
    492     if server_hostname:
--> 493         return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
    494     else:

/opt/sfdc/python37/lib/python3.7/ssl.py in wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, session)
    422             context=self,
--> 423             session=session
    424         )

/opt/sfdc/python37/lib/python3.7/ssl.py in _create(cls, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, context, session)
    869                         raise ValueError("do_handshake_on_connect should not be specified for non-blocking sockets")
--> 870                     self.do_handshake()
    871             except (OSError, ValueError):

/opt/sfdc/python37/lib/python3.7/ssl.py in do_handshake(self, block)
   1138                 self.settimeout(None)
-> 1139             self._sslobj.do_handshake()
   1140         finally:

SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate (_ssl.c:1076)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions