【问题标题】:Databricks CLI: SSLError, can't find local issuer certificateDatabricks CLI:SSLError,找不到本地颁发者证书
【发布时间】:2020-09-14 16:06:45
【问题描述】:

我已经安装并配置了 Databricks CLI,但是当我尝试使用它时,我收到一条错误消息,指出它找不到本地颁发者证书:

$ dbfs ls dbfs:/databricks/cluster_init/
Error: SSLError: HTTPSConnectionPool(host='dbc-12345678-1234.cloud.databricks.com', port=443): Max retries exceeded with url: /api/2.0/dbfs/list?path=dbfs%3A%2Fda
tabricks%2Fcluster_init%2F (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer
 certificate (_ssl.c:1123)')))

上述错误是否表明我需要安装证书,或者以某种方式配置我的环境以便它知道如何找到正确的证书?

我的环境是带有 WSL (Ubuntu 20.04) 的 Windows 10(上面的命令来自 WSL/Ubuntu 命令行)。

Databricks CLI 已安装到 Anaconda 环境中,包括以下证书和 SSL 包:

$ conda list | grep cert
ca-certificates           2020.6.20            hecda079_0    conda-forge
certifi                   2020.6.20        py38h32f6830_0    conda-forge
$ conda list | grep ssl
openssl                   1.1.1g               h516909a_1    conda-forge
pyopenssl                 19.1.0                     py_1    conda-forge

当我尝试将 REST API 与 curl 一起使用时,我遇到了类似的错误:

$ curl -n -X GET https://dbc-12345678-1234.cloud.databricks.com/api/2.0/clusters/list
curl: (60) SSL certificate problem: unable to get local issuer certificate
More details here: https://curl.haxx.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.

【问题讨论】:

    标签: python ssl databricks databricks-cli


    【解决方案1】:

    可以通过禁用 SSL 证书验证来解决此问题。在 Databricks CLI 中,您可以通过在 Databricks 配置文件 .databrickscfg 中指定 insecure = True 来实现。

    【讨论】:

    • 你不应该设置insecure = True吗?将其设置为 False 也很有趣:-)。不设置 insecure 会导致 SSL 错误。
    • 没错。您可以see in their source code 他们不检查该参数的值,而只是检查它是否包含任何类型的值。如果是这样,他们然后设置verify = False,然后在他们的ApiClient 中用于请求(这就是为什么我错误地写在那里insecure = False :))。
    • 这似乎可行,但这是一个热修复解决方案(禁用 SSL 绝不应该是一个持久的解决方案)。有谁知道如何添加 dbfs 考虑的根证书?
    猜你喜欢
    • 2016-04-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-01
    • 2017-08-31
    • 2018-07-04
    • 1970-01-01
    • 2023-04-01
    相关资源
    最近更新 更多