【问题标题】:Skip wget certificate checking in opam在 opam 中跳过 wget 证书检查
【发布时间】:2019-11-20 21:35:51
【问题描述】:

我刚刚更新到 opam 2,在我无法更新(运行 OS X 10.6.8)的非常旧的 MacBook 上,并且缺少一些与证书验证相关的重要软件包(并且由于缺少工具,我什至无法更新自制,因为它需要认证......有点循环问题)。

我想在不检查证书的情况下更新 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。没有它,我无能为力。

有没有办法将选项 --no-check-certificate 传递给 opam 使用的 wget 命令,而无需自己重新编译?

【问题讨论】:

    标签: wget osx-snow-leopard opam


    【解决方案1】:

    改为修复您的wget。看起来它缺少最近的 CA 包。

    首先,检查它在哪里寻找捆绑包 -

    $ 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's .pem bundle 以匹配预期的 .pem 路径。

    如果您使用的系统缺少 strace,或者在输出中根本没有提及 CA 捆绑包位置,请尝试创建 .wgetrc,然后添加

    ca_certificate = /path/to/your/ca-bundle.pem
    

    另存为$HOME/.wgetrc

    wget 然后应该能够验证 Let's Encrypt 证书。

    更多关于.wgetrchttp://gnu.org/software/wget/manual/html_node/Wgetrc-Commands.html

    【讨论】:

    • 不幸的是,我的 Mac OS X 中没有strace。根据this question,等价的应该是sudo dtruss -f -t open wget https://github.com,但它只显示/usr/local/opt/openssl/lib/libssl.1.0.0.dylib 和一些类似的文件,并且从未尝试过打开cert.pem。此外,/usr/lib/ssl 不存在。无论如何,我会尝试找到它应该放在哪里。
    • 尝试创建.wgetrc,并添加ca_certificate = /path/to/your/ca.pem。你应该把它放在$HOME/.wgetrc 中。更多gnu.org/software/wget/manual/html_node/Wgetrc-Commands.html
    • 完美!它确实比尝试使用我在其他地方找到的方法(但最终没有用)安装证书更好、更快。我建议将.wgetrc 建议放在答案中,以使其更加明显,因为这对我有用。
    猜你喜欢
    • 1970-01-01
    • 2022-01-18
    • 2019-04-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-28
    • 2011-03-23
    • 2017-08-06
    相关资源
    最近更新 更多