如何更新 certifi 的根证书?

how do I update root certificates of certifi?

我正在使用 certifi python 模块来验证 ssl 连接。我查看了 certifi (python2.7/site-packages/certifi/cacert.pem) 中包含的根证书,其中一些证书已过期。如何更新这些证书?我尝试使用 pip 更新 certifi 包,但这只会更新包而不是根 CA 文件。

certifi/cacert.pem 自然是 certifi 的一部分。因此,它应该与模块一起更新。

  • 您可以检查 https://github.com/certifi/python-certifi 的最新代码是否有更新的包,如果有,直接从那里使用 pip install git+https://github.com/certifi/python-certifi 安装模块。
  • 您还可以将 cacert.pem 替换为满足您需要的任何其他证书包,例如 Mozilla root certificate store。当然,您的更改将在您下次更新模块时丢失。