ssl - Curl 无法处理网站给出 ssl 错误
问题描述
尝试使用自制软件安装某些东西时,我遇到了来自 curl 和证书问题的大量消息。
以为cert.pem
文件有问题,但实际上并没有。
brew install ffmpeg
下载了很多包,很顺利,然后需要glib的包:
curl https://download.gnome.org/sources/glib/2.66/glib-2.66.1.tar.xz
curl: (77) SSL: can't load CA certificate file cacert.pem
如果错误是由于环境变量问题引起的,我尝试了:
curl --cacert ./cacert.pem https://download.gnome.org/sources/glib/2.66/glib-2.66.1.tar.xz
curl: (35) SSL peer handshake failed, the server most likely requires a client certificate to connect
我想验证 wget 是否有同样的问题。但是 wget 似乎能够在 gnome.org 上“失败”,并为 rpmfind.net 自动更改
wget https://download.gnome.org/sources/glib/2.66/glib-2.66.1.tar.xz
https://download.gnome.org/sources/glib/2.66/glib-2.66.1.tar.xz
Résolution de download.gnome.org (download.gnome.org)… 8.43.85.29, 8.43.85.13, 8.43.85.14, ...
Connexion à download.gnome.org (download.gnome.org) 8.43.85.29 :443… connecté.
requête HTTP transmise, en attente de la réponse… 302
Found Emplacement : http://ftp.rpmfind.net/linux/gnome.org/sources/glib/2.66/glib-2.66.1.tar.xz
suivant
http://ftp.rpmfind.net/linux/gnome.org/sources/glib/2.66/glib-2.66.1.tar.xz
Résolution de ftp.rpmfind.net (ftp.rpmfind.net)… 195.220.108.108
Connexion à ftp.rpmfind.net (ftp.rpmfind.net) 195.220.108.108 :80… connecté.
requête HTTP transmise, en attente de la réponse… 200 OK
Taille : 4834784 (4,6M) application/x-xz
Sauvegarde en: glib-2.66.1.tar.xz
然后我用 curl 和 rpmfind.net 进行了检查,一切顺利:
curl --cacert ./cacert.pem https://fr2.rpmfind.net/linux/gnome.org/sources/glib/2.66/glib-2.66.1.tar.xz
Safari 浏览器也无法访问https://download.gnome.org/sources/
因此,无法按照某些帖子中的建议进行操作:在 MacOSX 钥匙串中添加 gnome.org 证书。
为什么 curl 提示 SSL/CA 证书错误?
我看到了很多关于 homebrew、curl 和证书的线程,但似乎没有一个与这个案例有关。并且 homebrew 能够安装其他软件包,当它们不在 gnome.org 上时。
自制软件中有没有办法使用 wget 而不是 curl?
是否可以修改自制软件的配方,以便它可以在其他地方获得包装?
感谢您提供任何线索。
解决方案
感谢这篇文章:
如何手动下载 brew 包进行安装?
我能够将下载的 glib 包从 rpmfind 移动到自制软件缓存结构的正确位置和名称。
brew --cache glib
给出缓存的 glib 包的正确自制程序名称。
mv glib-2.66.1.tar.xz [homebrew name]
brew install glib
现在可以了,因为丢失的包位于托管目录中。
推荐阅读
- reporting-services - SSRS垂直条形图,设置类别表达式后X轴标签重复?
- node.js - 使用节点 sdk v4 使用 MS Teams 通道在 Bot 中获取用户配置文件
- ansible - Ansible:如何通过主机组中的索引号获取主机
- javascript - 承诺返回时不解决价值
- ios - 如何在 wkwebview 中为某些指定的 url 加载 css 文件?
- vue.js - socket.io-client 的动态地址
- php - PHP foreach 具有函数名称的数组并动态执行它们
- spring - ConcurrentModificationException:更新spring数据jpa父实体时
- git - 从另一个仓库推送到仓库
- maven - Heroku:使用 `gitlab-ci` 部署 jhipster 项目由于`Procfile`命令而崩溃