【问题标题】:Installing curl with ssl so I can install homebrew用 ssl 安装 curl,这样我就可以安装 homebrew
【发布时间】:2011-07-03 21:20:29
【问题描述】:

解决方案

我使用 Bruno 的帖子找到了解决方案,但觉得它需要更具体,所以这就是我所做的。

  1. 已将cacert.pem 下载到我的 ~/.ssh 目录中(我不知道这是否应该去,但我看到有人在尝试寻找解决方案时做了类似的事情,所以我把它放在这里) .
  2. 为安装设置环境变量 CURL_CA_BUNDLE。这实际上是失败建议的the website 中的解决方案4。我只是误解了他们在说什么(一个简单的例子可能让我避免了几个小时的困惑)。无论如何,你需要指定.pem文件的完整路径,然后你可以像这样安装$ CURL_CA_BUNDLE=~/.ssh/cacert.pem ruby -e "$(curl -fsSL @987654323@)"然后就可以安装了!

原始问题

我该怎么做

  1. 安装自制软件,或
  2. 使用 SSL 安装 curl 以便我可以安装自制软件?

我在 Mac OSX Leopard 上。

我正在尝试install homebrew,但我收到以下错误:

$ ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/Formula/...
/usr/local/Library/Homebrew/...
==> The following directories will be made group writable:
/usr/local/bin
/usr/local/lib
/usr/local/lib/pkgconfig
/usr/local/share/man/man1
/usr/local/share/man/man3

Press enter to continue
==> /usr/bin/sudo /bin/chmod g+w /usr/local/bin /usr/local/lib /usr/local/lib/pkgconfig /usr/local/share/man/man1 /usr/local/share/man/man3
==> Downloading and Installing Homebrew...
curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). The default
 bundle is named curl-ca-bundle.crt; you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.

gzip: stdin: unexpected end of file
/usr/bin/tar: Child returned status 1
/usr/bin/tar: Error exit delayed from previous errors
Failed during: /bin/bash -o pipefail -c '/usr/bin/curl -sSfL https://github.com/mxcl/homebrew/tarball/master | /usr/bin/tar xz -m --strip 1'

我尝试使用 macports 安装 curl 并指定 +ssl,但这不起作用(抱歉,我不记得错误是什么,我花了大约一个小时才到达那个位置,所以我没有想再做一次)。我从 macports 卸载 curl,然后运行 ​​$ whereis curl,但什么也没找到。

所以我转到上面错误消息中建议的the site。大多数选项似乎都不适用,但选项 5 有点道理:

获得更好/不同/更新的 CA 证书包! 一种选择是提取最近 Firefox 浏览器使用的那个 通过在 curl 构建树根中运行“make ca-bundle”

所以我得到curl source code 并运行$ ./buildconf$ ./configure$ make$ make ca-bundle,最后是$ sudo make install。我检查了$ whereis curl,上面写着“/usr/bin/curl”。

但是当我再次运行 homebrew install 命令时(在新的终端窗口中),我得到了上面显示的相同错误。

【问题讨论】:

    标签: ssl curl homebrew ca


    【解决方案1】:

    你不需要重新编译cURL,它已经支持SSL/TLS,否则不会显示error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

    您需要的是一组 CA 证书,例如您尝试与之通信的服务器的服务器证书是由其中一个 CA 颁发的。

    你从链接链接到http://curl.haxx.se/docs/caextract.html的cURL页面

    您应该能够下载组合的 PEM 捆绑包并使用它。你可以在上面的命令中使用curl -fsSL --cacert /path/to/bundle.pem https://...强制它,或者在运行命令之前使用export CURL_CA_BUNDLE=/path/to/bundle.pem

    通常情况下,您需要一种方法来信任此捆绑包中的内容,但在导入商业 CA 时总是存在“信仰飞跃”的元素(与大多数浏览器)。

    【讨论】:

      【解决方案2】:

      由于某种原因,原始海报的解决方案对我不起作用。即使使用新的 CA 包,我在安装过程中仍然遇到 SSL 错误:

      在以下期间失败:/bin/bash -o pipefail -c '/usr/bin/curl -sSfL https://github.com/mxcl/homebrew/tarball/master | /usr/bin/tar xz -m --strip 1'

      所以我没有直接执行安装脚本,而是先下载了它,然后将-k 开关(或--insecure)添加到它的 curl 命令(在今天版本的第 126 行找到),然后运行修补安装脚本。

      首先,无论如何都要更新 curl 包,使用 this method,但如果您没有 wget,请使用 curl

      cd /usr/share/curl/
      sudo curl http://curl.haxx.se/ca/cacert.pem -o cacert.pem
      sudo mv curl-ca-bundle.crt old.curl-ca-bundle.crt
      sudo mv cacert.pem curl-ca-bundle.crt
      

      然后转到https://github.com/mxcl/homebrew/wiki/installation 并复制安装程序脚本链接。

      获取安装程序脚本:(将 URL 替换为当前安装程序脚本 URL)

      curl -fsSL https://raw.github.com/gist/323731 -o homebrew-install.rb
      

      编辑 homebrew-install.rb:搜索“curl”并添加 -k 开关

      最后,运行你的补丁脚本:

      ruby homebrew-install.rb
      

      【讨论】:

        【解决方案3】:

        原始说明在 OS X 10.9 中对我来说很好用!
        首先下载并安装 XQuartz

        不知道为什么我需要将任何东西放入 ~/.ssh,但是可以

        系统偏好设置
        分享
        “检查”远程登录
        “单击”+ 添加您的用户名
        然后在 xquartz 中输入
        ssh localhost answer yes to all type exit

        下载pem file
        保存到下载
        在xquartz类型中

        cd
        
        cp Downloads/cacert.pem .ssh/cacert.pem
        

        pem 文件没有抱怨我需要导出以下工作正常

        CURL_CA_BUNDLE=~/.ssh/cacert.pem
        
        ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
        

        如果您尚未安装命令行实用程序,系统会提示您安装
        点击确定并按照提示操作
        系统会提示您仔细输入您的密码,然后按 Enter

        brew doctor
        brew update
        brew doctor
        brew search ssl
        brew install openssl
        

        “我作为一个前端 UXD 类型的人;为不需要 DL 2.09 GB xcode.app 感到高兴”

        【讨论】:

          【解决方案4】:

          ruby -e "$(curl -k -fsSL https://raw.github.com/Homebrew/homebrew/go/install)" 有效,因为 -k 允许不安全的 SSL 连接

          【讨论】:

          • 命令现在是ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
          猜你喜欢
          • 1970-01-01
          • 2015-12-05
          • 1970-01-01
          • 2018-02-22
          • 1970-01-01
          • 2022-12-04
          • 1970-01-01
          • 2020-01-11
          • 2013-12-25
          相关资源
          最近更新 更多