Unable to connect to presto-coordinator using SSL
Hi Folks,
I am trying to connect to my presto coordinator from superset over https but i am getting this error. superset_1 | requests.exceptions.SSLError: HTTPSConnectionPool(host='**************.cloud', port=443): Max retries exceeded with url: /v1/statement (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)'),))
Expected results
This is expected to connect to my presto-coordinator which is running on https port
- superset version:
Latest - python version:
3.6.9 - node.js version:
v10.17.0 - npm version:
6.11.3 - pip version:
pip 9.0.2 from /usr/local/lib/python3.6/site-packages (python 3.6)
Parameters Used
SQLAlchemy URI: presto://<presto_coordinator>:
Extra: { "metadata_params": {}, "engine_params": { "connect_args":{ "protocol": "https", "requests_kwargs": { "verify": "/home/superset/tls.pem" } } }, "metadata_cache_timeout": {}, "schemas_allowed_for_csv_upload": []
Checklist
Make sure these boxes are checked before submitting your issue - thank you!
- [x] I have checked the superset logs for python stack traces and included it here as text if there are any.
- [x] I have reproduced the issue with at least the latest released version of the superset.
- [x] I have checked the issue tracker for the same issue and I haven't found one similar.
Issue Label Bot is not confident enough to auto-label this issue. See dashboard for more details.
Issue Label Bot is not confident enough to auto-label this issue. See dashboard for more details.
i want to post this as a question @issue-label-bot
🏷 question
Looks like requests_kwargs is not being passed to requests, let me take a look.
@betodealmeida is there any way to enable debugging mode for superset
Is this because i am not using a self signed certificate. I am actually using certificate provided by my cloud kubernetes team. Since my presto app is deployed in kubernetes. I am using those certificates in superset as well. @betodealmeida
Had to look this up, FYI: https://github.com/dropbox/PyHive/blob/6925cd74721cc474a02a6759490b2b4c8bef3831/pyhive/presto.py#L107
@mistercrunch didn't quite get it. What do you mean? Can u brief up a little bit pls
Just for sanity check on @betodealmeida investigation around request_kwargs being passed to requests, can you please make a test with "verify": false and report back?
@dpgaspar
I tried with "verify": false
superset_1 | b'<html>\n<head>\n<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>\n<title>Error 401 Unauthorized</title>\n</head>\n<body><h2>HTTP ERROR 401</h2>\n<p>Problem accessing /v1/statement. Reason:\n<pre> Unauthorized</pre></p>\n</body>\n</html>\n'
superset_1 | [SQL: SELECT 1]
superset_1 | (Background on this error at: http://sqlalche.me/e/e3q8)
superset_1 | 172.22.0.1 - - [10/Dec/2019 17:48:42] "POST /superset/testconn HTTP/1.1" 500 -
Also, i tried "verify": "false" and I am getting the below error.
superset_1 | "invalid path: {}".format(cert_loc))
superset_1 | OSError: Could not find a suitable TLS CA certificate bundle, invalid path: false
superset_1 | 172.22.0.1 - - [10/Dec/2019 17:50:19] "POST /superset/testconn HTTP/1.1" 500 -```
Thank you, I think that helps, seems like request_kwargs is actually getting at the requests pkg, the first error is interesting, would risk saying you don't have access to presto (credentials).
@dpgaspar Is there any way that we can pass jks file instead of PEM file for the SSL to happen b/w presto and superset. The Keystore file was earlier working for us with another tool.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.
Hi! I think that we should re-open this issue, I am currently testing the new version of PyHive with a self signed certificate and it doesn't work. More specifically, I don't see any difference if I set requests_kwargs among the extras. I failed also to pass it via sql alchemy URL.
As @mistercrunch mentioned, https://github.com/dropbox/PyHive/blob/6925cd74721cc474a02a6759490b2b4c8bef3831/pyhive/presto.py#L107 is a good starting point, but I haven't figure out yet where a Cursor is used in Superset and how to see if requests_kwarg is passed.
After some tries I think that something like the following works:
"engine_params": {
"connect_args": {
"requests_kwargs": {
"verify": "/some/path/to/ca"
}
}
This works fine for me now. You need to ensure that the cert is in .PEM format only. One way to find our the pem file which is working is you can do a curl -v https://presto-ui name this would give you a pem file in your local desktop. You can use this .PEM file to connect via superset also.
{
"metadata_params": {},
"engine_params": {
"connect_args":{
"protocol": "https",
"requests_kwargs": {
"verify": "path.pem"
}
}
},
"metadata_cache_timeout": {},
"schemas_allowed_for_csv_upload": []
}
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.
@craig-rueda anything left to do? I think that the task is done, can we close?
Hi, thanks for your contributions in order to clarify this issue, I have included my .pem certificate as part of the requests_kwargs': {'verify': 'path.file.pem')}, however it returns this error, I can't find a way for fixing it :(
OpenSSL.SSL.Error: [('x509 certificate routines', 'X509_load_cert_crl_file', 'no certificate or crl found')]
thanks for any suggestion, cheers.
This works fine for me now. You need to ensure that the cert is in .PEM format only. One way to find our the pem file which is working is you can do a curl -v https://presto-ui name this would give you a pem file in your local desktop. You can use this .PEM file to connect via superset also.
{ "metadata_params": {}, "engine_params": { "connect_args":{ "protocol": "https", "requests_kwargs": { "verify": "path.pem" } } }, "metadata_cache_timeout": {}, "schemas_allowed_for_csv_upload": [] }
Hi Bharat, May I know how you solved the issue? I am also facing the same issue.