使用ssl安装curl,这样我就可以安装自制程序了



解决方案

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

  1. 将cacert.pem下载到我的~/.ssh目录中(我不知道它是否应该放在这里,但我看到有人在试图找到解决方案时做了类似的事情,所以我把它放在这里(
  2. 为安装设置env var CURL_CA_BUNDLE。这实际上是网站上故障建议的第4个解决方案。我只是误解了他们在说什么(一个简单的例子可能会让我省去几个小时的困惑(。无论如何,你需要指定.pem文件的完整路径,然后你可以像这样安装$ CURL_CA_BUNDLE=~/.ssh/cacert.pem ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)",然后它就安装好了

最初的问题

我该怎么做

  1. 安装自制软件,或
  2. 用SSL安装curl,这样我就可以安装自制软件了

我在Mac OSX Leopard上。

我正在尝试安装自制软件,但我得到以下错误:

$ 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,它什么也找不到。

所以我去了上面错误消息中建议的网站。大多数选项似乎不适用,但选项5有一定的意义:

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

因此,我获得了curl源代码,并运行$ ./buildconf$ ./configure$ make$ make ca-bundle,最后运行$ sudo make install。我检查了$ whereis curl,它显示"/usr/bin/ccurl"。

但当我再次运行自制软件安装命令时(在一个新的终端窗口中(,我会得到上面显示的相同错误。

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

您需要的是一组CA证书,例如您试图与之交谈的服务器的服务器证书,它是由其中一个CA颁发的。

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

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

通常,你需要一种方法来信任这个捆绑包中的内容,但在导入商业CA时,总是有"信心的飞跃"的元素(就像它们与大多数浏览器捆绑在一起一样(。

由于某些原因,最初发布者的解决方案对我不起作用。即使使用了新的CA捆绑包,我在安装过程中仍然存在SSL错误:

失败期间:/bin/bash-o pipefail-c'/usr/bin/ccurl-sSfLhttps://github.com/mxcl/homebrew/tarball/master|/usr/bin/tar xz-m--剥离1'

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

首先,无论如何,使用此方法更新卷曲束,但使用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

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

不确定为什么我需要在~/.ssh中放置任何东西,但可以

系统首选项
共享
"检查"远程登录
"单击"+添加您的用户名
然后在xquartz类型
ssh localhost answer yes to all type exit

下载pem文件
保存到下载
x石英型

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)"

如果尚未安装命令行实用程序,系统将提示您进行安装
单击"确定"并按照提示操作
将有一个提示您的密码类型小心并点击回车

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

"我是一个前端UXD类型的人;很高兴地惊讶于不需要DL 2.09 GB xcode.app">

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

相关内容

最新更新