0

我只想知道当我启动命令 >berks intall 时如何在 Windows 平台下为 Berkshelf3 设置代理值(Url、用户、密码)?

  • 我已经在 cmd 命令中尝试过:
    http_proxy=' http://xx.xx.xx.xx '
    http_proxy_user=USERNAME
    http_proxy_pass=PASSWORD

  • 悬而未决的问题:

    C:\chef-repo-distant\cookbooks\putty>berks install Resolving cookbook dependencies... 从 . 从 ttps://supermarket.getchef.com 获取食谱索引... C:/opscode/chefdk/embedded/lib/ruby/2.0.0/net/http.rb:918:in connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certific ate verify failed (Faraday::SSLError) from C:/opscode/chefdk/embedded/lib/ruby/2.0.0/net/http.rb:918:inblock in connect' 从 C:/ opscode/chefdk/embedded/lib/ruby/2.0.0/timeout.rb:66:intimeout' from C:/opscode/chefdk/embedded/lib/ruby/2.0.0/net/http.rb:918:in从 C:/opscode/chefdk/embedded/lib/ruby/2.0.0/net/http.rb:862:in 连接do_start' from C:/opscode/chefdk/embedded/lib/ruby/2.0.0/net/http.rb:851:in从 C:/opscode/chefdk/embedded/lib/ruby/2.0.0/net/http.rb:1367:inrequest' from C:/opscode/chefdk/embedded/lib/ruby/2.0.0/net/http.rb:1126:in开始'从 C:/opscode/chefdk/embedded/lib/ruby/gems/2.0.0 /gems/faraday-0.9.0/lib/faraday/adapter/net_http.rb:78:in perform_request' from C:/opscode/chefdk/embedded/lib/ruby/gems/2.0.0/gems/faraday-0.9.0/lib/faraday/adapter/net_http.rb:39:incall' 来自 C:/opscode/chefdk/embedded/lib/ruby/gems/2.0.0/gems/faraday-0.9。 0/lib/faraday/request/retry.rb:87:incall' from C:/opscode/chefdk/embedded/lib/ruby/gems/2.0.0/gems/faraday-0.9.0/lib/faraday/response.rb:8:in来自 C:/opscode/chefdk/embedded/lib/ruby/gems/2.0.0/gems/faraday-0.9.0/lib/faraday/response.rb:8:in call' from C:/opscode/chefdk/embedded/lib/ruby/gems/2.0.0/gems/faraday-0.9.0/lib/faraday/rack_builder.rb:139:inbuild_response 的调用'来自 C:/opscode/chefdk /embedded/lib/ruby/gems/2.0.0/gems/faraday-0.9.0/lib/faraday/connection.rb:377:in run_request' from C:/opscode/chefdk/embedded/lib/ruby/gems/2.0.0/gems/faraday-0.9.0/lib/faraday/connection.rb:140:inget' from C:/opscode/chefdk/embedded/lib/ruby/gems/ 2.0.0/gems/berkshelf-api-client-1.2.0/lib/berkshelf/api_client/connection.rb:62:in universe' from c:/opscode/chefdk/embedded/apps/berkshelf/lib/berkshelf/source.rb:22:inbuild_universe' 来自 c:/opscode/chefdk/embedded/apps/berkshelf/lib/berkshelf/installer .rb:21:in `block (2 levels) in build_universe'

感谢您的支持!


尝试遵循我可以在网上找到的所有修复,但它没有成功:(

我在我的 Berksfile 中使用“source 'ttp://api.berkshelf.com”
并在 powershell windows 中启动命令 berks install

没有代理集,我得到:

Error retrieving universe from source: ttp://api.berkshelf.com
  * [Berkshelf::APIClient::TimeoutError] Unable to connect to: ttp://api.berkshelf.com

使用代理集,我得到:

Installing windows (1.34.2) from ttp://api.berkshelf.com ([opscode] ttp://supermarket.getchef.com/api/v1)
E, [2014-09-01T18:27:50.775682 #13104] ERROR -- : Actor crashed!
Faraday::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
        C:/opscode/chefdk/embedded/lib/ruby/2.0.0/net/http.rb:918:in `connect'
        C:/opscode/chefdk/embedded/lib/ruby/2.0.0/net/http.rb:918:in `block in connect'
        C:/opscode/chefdk/embedded/lib/ruby/2.0.0/timeout.rb:52:in `timeout'
        C:/opscode/chefdk/embedded/lib/ruby/2.0.0/net/http.rb:918:in `connect'
        C:/opscode/chefdk/embedded/lib/ruby/2.0.0/net/http.rb:862:in `do_start'
        C:/opscode/chefdk/embedded/lib/ruby/2.0.0/net/http.rb:851:in `start'
        C:/opscode/chefdk/embedded/lib/ruby/2.0.0/net/http.rb:1367:in `request'
        C:/opscode/chefdk/embedded/lib/ruby/2.0.0/net/http.rb:1126:in `get'
        C:/opscode/chefdk/embedded/lib/ruby/gems/2.0.0/gems/faraday-0.9.0/lib/faraday/adapter/net_http.rb:78:in `perform
_request'

我急于解决这个问题:(


是的,它工作我必须添加 3 个从 IE 检索的证书到cacert.pem!太好了 ;)
谢谢 Tensibai ;)

4

1 回答 1

1

你的问题在这里:

connect': SSL_connect 返回=1 errno=0 state=SSLv3 读取服务器证书 B: 证书验证失败 (Faraday::SSLError)

您的代理正在拦截 SSL 流量并使用自己的证书来签署远程站点证书。

所以你必须将你的代理证书添加到cacerts.pem你的 ruby​​ 安装中。

使用导航器显示 ssl 站点的代理信息并使用“复制到文件”并选择 base64 编码的 x509 格式。

接下来编辑此文件以复制其内容

编辑 cacert 文件(根据你安装的 chefdk 它将是c:/opscode/chefdk/embedded/ssl/cacerts.pem

在最后一个之前粘贴您的代理证书(以避免弄乱文件末尾)并重试应该可以解决问题。

在某些情况下,您必须设置 SSL_CERT_FILE 环境变量:

set SSL_CERT_FILE=c:/opscode/chefdk/embedded/ssl/cacerts.pem

资源

于 2014-09-01T12:00:41.023 回答