使用 cygwin python 3.8 证书验证失败

问题描述

我一直在为本地 https 站点使用我自己的 CA。当我开始使用 cygwin python 3.8 时,出现错误

eval "$(rbenv init -)"

Then I am setting ruby with global and local commands. And after that I get the following

git:(master) ✗ which ruby
/Users/pk/.rbenv/shims/ruby
git:(master) ✗ ruby -v
ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [x86_64-darwin19]
git:(master) ✗ rbenv local
2.7.3
git:(master) ✗ rbenv global
2.7.3

但是 wget 到相同的 url 工作正常。

解决方法

Python 3.8 带有 certifi,它有自己的证书存储

ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1125)

我从标准位置抓了本地 CA

/usr/local/lib/python3.8/site-packages/certifi/cacert.pem

并将其附加到证书 cacert.pem。

这可以解决 CERTIFICATE_VERIFY_FAILED 错误。