提问人:anol 提问时间:7/11/2019 最后编辑:anol 更新时间:7/11/2019 访问量:1936
跳过 opam 中的 wget 证书检查
Skip wget certificate checking in opam
问:
我刚刚在一台非常旧的 MacBook 上更新到 opam 2,我无法更新(运行 OS X 10.6.8),并且缺少一些与证书验证相关的重要软件包(由于缺少工具,我什至无法更新 Homebrew,因为它需要认证......有点循环问题)。
我想在不检查证书的情况下更新 opam,否则我会收到以下错误:
<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><> 🐫
[ERROR] Could not update repository "default":
OpamDownload.Download_fail(_, "Download command failed:
\"/usr/local/bin/wget --content-disposition -t 3 -O
/private/tmp/opam-17621-5a61c5/index.tar.gz.part
https://opam.ocaml.org/1.2.2/index.tar.gz -U opam/2.0.0\"
exited with code 5
\"ERROR: cannot verify opam.ocaml.org's certificate, issued by
'CN=Let\\'s Encrypt Authority X3,O=Let\\'s Encrypt,C=US':\"")
我只能从 1.2.2 升级到 opam 2.0.0,但现在我不能这样做。没有它,我无能为力。opam update
有没有办法将选项传递给 opam 使用的命令,而无需自己重新编译它?--no-check-certificate
wget
答:
2赞
evilSnobu
7/11/2019
#1
改修你的。看起来它缺少最近的 CA 捆绑包。wget
首先,检查它在哪里寻找捆绑包 -
$ strace wget -O /dev/null https://github.com 2>&1 | grep cert
read(3, "eting an end user certificate as"..., 4096) = 2806
read(5, "eting an end user certificate as"..., 4096) = 2806
openat(AT_FDCWD, "/usr/lib/ssl/cert.pem", O_RDONLY) = -1 ENOENT (No such file or directory)
然后复制 Mozilla 的 .pem 包以匹配预期的 .pem 路径。
如果您所在的系统缺少 CA 捆绑包位置,或者输出中根本没有提及 CA 捆绑包位置,请尝试创建一个 ,然后添加strace
.wgetrc
ca_certificate = /path/to/your/ca-bundle.pem
另存为 .$HOME/.wgetrc
wget
然后应该能够验证 Let's Encrypt 证书。
更多关于 http://gnu.org/software/wget/manual/html_node/Wgetrc-Commands.html.wgetrc
评论
0赞
anol
7/11/2019
不幸的是,我的Mac OS X中没有。根据这个问题,等价的应该是 ,但它只显示和几个类似的文件,并且从不尝试打开 .此外,不存在。无论如何,我会尝试找到它应该放在哪里。strace
sudo dtruss -f -t open wget https://github.com
/usr/local/opt/openssl/lib/libssl.1.0.0.dylib
cert.pem
/usr/lib/ssl
1赞
evilSnobu
7/11/2019
尝试创建一个 ,然后添加 .你应该把它放在 .更多内容请见 gnu.org/software/wget/manual/html_node/Wgetrc-Commands.html.wgetrc
ca_certificate = /path/to/your/ca.pem
$HOME/.wgetrc
1赞
anol
7/11/2019
完善!它确实比尝试使用我在其他地方找到的方法安装证书更好、更快(最终没有奏效)。我建议将建议放在答案中,以使其更明显,因为这是对我有用的建议。.wgetrc
评论