当我使用此命令来提取代码时:
\n\xe2\x9e\x9c rt-analysis-multibranch_zhuolian git:(zhuolian) git pull\nfatal: unable to access 'https://gitlab.example.com/development/soa-report-analysis.git/': SSL certificate problem: certificate has expired\nRun Code Online (Sandbox Code Playgroud)\n我确信证书没有过期,因为在其他 macOS PC 上我可以从同一网址提取代码。服务器端证书由 Let's Encrypt 生成。macOS Catalina openssl 版本是:
\n\xe2\x9e\x9c ~ openssl version\nLibreSSL 2.6.5\nRun Code Online (Sandbox Code Playgroud)\n我尝试使用curl,错误如下:
\n\xe2\x9e\x9c rt-analysis-multibranch_zhuolian git:(zhuolian) curl https://gitlab.example.com/development/soa-report-analysis.git\ncurl: (60) SSL certificate problem: certificate has expired\nMore details here: https://curl.haxx.se/docs/sslcerts.html\n\ncurl performs SSL certificate verification by default, using a "bundle"\n of Certificate Authority (CA) public keys (CA certs). If the default\n bundle file isn't adequate, you can specify an alternate file\n using the --cacert option.\nIf this HTTPS server uses a certificate signed by a CA represented in\n the bundle, the certificate verification probably failed due to a\n problem with the certificate (it might be expired, or the name might\n not match the domain name in the URL).\nIf you'd like to turn off curl's verification of the certificate, use\n the -k (or --insecure) option.\nHTTPS-proxy has similar options --proxy-cacert and --proxy-insecure.\nRun Code Online (Sandbox Code Playgroud)\n为什么会发生这种情况?我应该做什么来修复它?我可以使用相同的 URL 从 Google Chrome 浏览器访问该存储库。
\n我终于发现我上次ISRG Root X1默认使用根证书更新让我们加密证书。唯一ISRG Root X1兼容 macOS 10.12.1。但为什么curl命令似乎验证旧证书。为什么会发生这种情况?
小智 26
请参阅Ask Different的这个答案,无耻地转发如下:
macOS 上的 OpenSSL 不使用系统钥匙串(这很有意义,因为它是一个跨平台库),而是拥有自己的
.pem包含根证书的文件。尽管我的系统使用 homebrew 和/或 MacPorts 安装了较新版本的 OpenSSL,但位于 的系统范围 OpenSSL pem 文件已/etc/ssl/cert.pem过时,并且不包含 ISRG Root X1 证书。解决方案:
- 重命名
/etc/ssl/cert.pem为其他名称。(我建议/etc/ssl/cert.pem.org)cacert.pem从https://curl.se/docs/caextract.html下载最新版本- 将其重命名为
cert.pem- 将其复制到
/etc/ssl/cert.pem现在
curl,使用 OpenSSL 的任何其他应用程序都可以访问使用当前 Let's Encrypt 证书签名的网站。或者,MacPorts 软件包
curl-ca-bundle会安装一个.pem包含 ISRG Root X1 的文件,/opt/local/etc/openssl/cert.pem也可以使用该文件。其他可能的解决方案:
- 手动将 ISRG 根 X1 证书添加到
/etc/ssl/cert.pem- 配置 OpenSSL 以使用不同的
.pem文件作为其根证书,例如/opt/local/etc/openssl/cert.pem
(另一个可能的解决方案是使用curl的-k/--insecure标志。
| 归档时间: |
|
| 查看次数: |
13229 次 |
| 最近记录: |