用ssl安装curl所以我可以安装自制软件

时间:2011-07-03 21:20:29

标签: ssl curl homebrew ca

解决方案

我使用布鲁诺的帖子来找到解决方案,但觉得它需要更具体,所以这显然是我所做的。

  1. cacert.pem下载到我的〜/ .ssh目录中(我不知道这是不是应该去的地方,但我看到有人在尝试寻找解决方案时做了类似的事情,所以这就是我放的地方它)。
  2. 为安装设置env var CURL_CA_BUNDLE。这实际上是失败建议的the website解决方案4。我只是误解了他们的意思(一个简单的例子可能让我节省了数小时的困惑)。无论如何,您需要指定.pem文件的完整路径,然后您可以像这样安装$ CURL_CA_BUNDLE=~/.ssh/cacert.pem ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"然后安装它!

  3. 原始问题

    我如何

    1. 安装自制程序或
    2. 使用SSL安装curl以便我可以安装homebrew?
    3. 我在使用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命令时(在新的终端窗口中),我得到了上面显示的相同错误。

4 个答案:

答案 0 :(得分:5)

您不需要重新编译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时总会出现“信仰的飞跃”(就像它们捆绑给您的方式一样)浏览器)。

答案 1 :(得分:0)

出于某种原因,原始海报的解决方案对我不起作用。即使使用新的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行中找到),然后运行那个修补过的安装脚本。

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

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

答案 2 :(得分:0)

在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”

答案 3 :(得分:0)

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