python - 登录 Azure 容器注册表时 SSL 证书验证失败

标签 python azure ssl https

我是 Azure 新手,正在尝试从我的计算机 (Mac OS) 上运行命令行。我通过 homebrew 安装了 azure-cli,当我执行 az login 时,我收到以下错误:

Error occurred in request., SSLError: HTTPSConnectionPool(host='management.azure.com', port=443): Max retries exceeded with url: /tenants?api-version=2016-06-01 (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",),))
Traceback (most recent call last):
  File "/usr/local/Cellar/azure-cli/2.0.25/libexec/lib/python3.6/site-packages/urllib3/contrib/pyopenssl.py", line 441, in wrap_socket
    cnx.do_handshake()
  File "/usr/local/Cellar/azure-cli/2.0.25/libexec/lib/python3.6/site-packages/OpenSSL/SSL.py", line 1806, in do_handshake
    self._raise_ssl_error(self._ssl, result)
  File "/usr/local/Cellar/azure-cli/2.0.25/libexec/lib/python3.6/site-packages/OpenSSL/SSL.py", line 1546, in _raise_ssl_error
    _raise_current_error()
  File "/usr/local/Cellar/azure-cli/2.0.25/libexec/lib/python3.6/site-packages/OpenSSL/_util.py", line 54, in exception_from_error_queue
    raise exception_type(errors)
OpenSSL.SSL.Error: [('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')]

我尝试过以下方法:

export ADAL_PYTHON_SSL_NO_VERIFY=1
export AZURE_CLI_DISABLE_CONNECTION_VERIFICATION=1

据此:https://github.com/Azure/azure-cli/issues/2267

这让我可以登录,但是当我执行 az acr login --name <registry name> 时我再次遇到类似的错误:

HTTPSConnectionPool(host='registryName.azurecr.io', port=443): Max retries exceeded with url: /v2/ (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",),))
Traceback (most recent call last):
  File "/usr/local/Cellar/azure-cli/2.0.25/libexec/lib/python3.6/site-packages/urllib3/contrib/pyopenssl.py", line 441, in wrap_socket
    cnx.do_handshake()
  File "/usr/local/Cellar/azure-cli/2.0.25/libexec/lib/python3.6/site-packages/OpenSSL/SSL.py", line 1806, in do_handshake
    self._raise_ssl_error(self._ssl, result)
  File "/usr/local/Cellar/azure-cli/2.0.25/libexec/lib/python3.6/site-packages/OpenSSL/SSL.py", line 1546, in _raise_ssl_error
    _raise_current_error()
  File "/usr/local/Cellar/azure-cli/2.0.25/libexec/lib/python3.6/site-packages/OpenSSL/_util.py", line 54, in exception_from_error_queue
    raise exception_type(errors)
OpenSSL.SSL.Error: [('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')]

我能做些什么来解决这个问题吗?提前致谢。

最佳答案

关于python - 登录 Azure 容器注册表时 SSL 证书验证失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48469614/

相关文章:

azure - 如何在 NewRelic 中跟踪 Azure Web 应用程序的部署?

azure - 如何对搜索引擎隐藏 azure vm 技术 url?

python - 使用 SOCK_STREAM 代理处理 https 请求

python - Pi 上的 Pygame 通过 Putty 运行,无屏幕,无输入

python - DBus 接口(interface)属性

python - 如何使用 Xlwings 向 Excel 中的单元格添加注释

azure - 从我的 azure 函数中检索主机 key

java - 页面的安全或 https 不起作用

java - 如何在其余调用中包含 SSL 证书

数据库