简体   繁体   English

使用 Python 3.10 从本地服务器进行 pip 安装时出现“CA MD TOO WEAK”

[英]“CA MD TOO WEAK” when pip-installing from local server with Python 3.10

Starting with Python 3.10, I get “CA MD TOO WEAK” when I try to “pip install” any Python package.从 Python 3.10 开始,当我尝试“pip install”任何 Python 包时,我得到“CA MD TOO WEAK”。 Is it because my local Python package index is on a server that has weak certificates?是因为我的本地 Python 包索引位于证书较弱的服务器上吗?

Background背景

We have an in-house PyPI server that provides (only) in-house packages.我们有一个内部 PyPI 服务器,它(仅)提供内部包。 (We do not allow our package index to refer to the global PyPI package indexes at files.pythonhosted.org and pypi.org because of the security risk in which a malicious actor can post Trojan-horse packages on the global server with (guessed) names that match in-house package names.) Given the different package indexes, my pip.ini needs to identify both the local server and the global servers. (我们不允许我们的包索引引用files.pythonhosted.orgpypi.org上的全局 PyPI 包索引,因为恶意行为者可以在全局服务器上发布特洛伊木马包的安全风险(猜测)名称匹配内部包名称。)给定不同的包索引,我的pip.ini需要识别本地服务器和全局服务器。 The local server requires certificates.本地服务器需要证书。

My pip.ini is:我的pip.ini是:

[global]
trusted-host = files.pythonhosted.org pypi.org <internal.host>
index-url = https://<internal.host>/devpi/root/<dir>/+simple
extra-index-url = https://pypi.org/simple/
cert = C:\Users\<user>\combined.cert.pem
client-cert = C:\Users\<user>\<user>.pem

[search]
index = https://<internal.host>/devpi/root/dir

When I upgraded from Python 3.9 to Python 3.10, 'pip install anything' failed with the message “CA MD TOO WEAK”.当我从 Python 3.9 升级到 Python 3.10 时,“pip install anything”失败并显示“CA MD TOO WEAK”消息。 This does not happen when I avoid my pip.ini and install directly from the public servers.当我避免我的pip.ini并直接从公共服务器安装时,不会发生这种情况。

Here's my attempt at answering my own question -- improvements and comments are welcome!这是我回答我自己问题的尝试——欢迎改进和评论!

The short answer is "yes" -- I am getting the error because Python 3.10 now uses OpenSSL 1.1.1 , along with security level 1, and my in-house server certificates don't use enough bits, or rely on MD5.简短的回答是“是”——我收到错误是因为 Python 3.10 现在使用OpenSSL 1.1.1以及安全级别 1,而且我的内部服务器证书没有使用足够的位,或者依赖 MD5。

The best fix to get my server operators to use stronger certificates (and re-issue public certificates).让我的服务器操作员使用更强大的证书(并重新颁发公共证书)的最佳解决方案。 The requirements for SSL security level 1 are given here . 此处给出了 SSL 安全级别 1 的要求。 This might be a painful step for the IT team -- they'd have to re-issue certificates to everybody.对于 IT 团队来说,这可能是一个痛苦的步骤——他们必须向每个人重新颁发证书。

In the meantime, I need to downgrade to Python 3.9.同时,我需要降级到 Python 3.9。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM