【问题标题】:Why can't I install a vagrant environment with chef? certificate verify failed (OpenSSL::SSL::SSLError)为什么我不能用厨师安装流浪环境?证书验证失败(OpenSSL::SSL::SSLError)
【发布时间】:2014-12-27 04:54:08
【问题描述】:

我的环境:

OS: Mac 10.10.1
rbenv: rbenv 0.4.0-129-g7e0e85b
Ruby: ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-darwin14.0]

我的流浪文件:

# -*- mode: ruby -*-
# vi: set ft=ruby :

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  # Use Ubuntu 14.04 Trusty Tahr 64-bit as our operating system
  config.vm.box = "precise32"

  # Configurate the virtual machine to use 2GB of RAM
  config.vm.provider :virtualbox do |vb|
    vb.customize ["modifyvm", :id, "--memory", "2048"]
  end

  # Forward the Rails server default port to the host
  config.vm.network :forwarded_port, guest: 3000, host: 3000

  # Use Chef Solo to provision our virtual machine
  config.vm.provision :chef_solo do |chef|
    chef.cookbooks_path = ["cookbooks", "site-cookbooks"]

    chef.add_recipe "apt"
    chef.add_recipe "nodejs"
    chef.add_recipe "ruby_build"
    chef.add_recipe "rbenv::user"
    chef.add_recipe "rbenv::vagrant"
    chef.add_recipe "vim"
    chef.add_recipe "mysql::server"
    chef.add_recipe "mysql::client"

    # Install Ruby 2.1.2 and Bundler
    # Set an empty root password for MySQL to make things simple
    chef.json = {
      rbenv: {
        user_installs: [{
          user: 'vagrant',
          rubies: ["2.1.2"],
          global: "2.1.2",
          gems: {
            "2.1.2" => [
              { name: "bundler" }
            ]
          }
        }]
      },
      mysql: {
        server_root_password: ''
      }
    }
  end
end

我的厨师档案:

site "http://community.opscode.com/api/v1"

cookbook 'apt'
cookbook 'build-essential'
cookbook 'mysql'
cookbook 'ruby_build'
cookbook 'nodejs', git: 'https://github.com/mdxp/nodejs-cookbook'
cookbook 'rbenv', git: 'https://github.com/fnichol/chef-rbenv'
cookbook 'vim'

在我运行vagrant up 之后,我得到了这些错误:

➜ MY_RAILS_PROJECT vagrant up
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/util/which.rb:32: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
Bringing machine 'default' up with 'virtualbox' provider...
[default] Importing base box 'precise32'...
[default] Matching MAC address for NAT networking...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[default] Installing Chef cookbooks with Librarian-Chef...
[default] Destroying VM and associated drives...
[default] Running cleanup tasks for 'chef_solo' provisioner...
/Applications/Vagrant/embedded/lib/ruby/1.9.1/net/http.rb:800:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/net/http.rb:800:in `block in connect'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/timeout.rb:55:in `timeout'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/timeout.rb:100:in `timeout'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/net/http.rb:800:in `connect'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/net/http.rb:756:in `do_start'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/net/http.rb:745:in `start'
from /Users/jingqiangzhang/.vagrant.d/gems/gems/librarian-chef-0.0.4/lib/librarian/chef/source/site.rb:353:in `block in http_get'

我找到了这篇文章:

我可以确认我的 openssl 版本:

➜  MY_RAILS_PROJECT  openssl version
OpenSSL 1.0.1j 15 Oct 2014

不知道是什么原因。

【问题讨论】:

    标签: ruby macos openssl vagrant chef-infra


    【解决方案1】:

    将您的网站更改为https://supermarket.chef.io/api/v1。如果仍然失败,您将需要更新您的 TLS CA 数据。我不确定 Vagrant 是如何处理这个问题的,但是如果你有一个正常工作的 Python 安装,你可以尝试使用 certifi:

    pip install certifi
    export SSL_CERT_FILE="$(python -m certifi)"
    

    【讨论】:

    • 非常感谢。原因是TLS CA data。它由您的指南工作:) 但似乎没有必要更改 Cheffile 的站点。
    • 仍然推荐,您列出的主机名只是重定向到我提供的内容。
    猜你喜欢
    • 2012-09-26
    • 1970-01-01
    • 2012-05-26
    • 2013-01-06
    • 1970-01-01
    • 2021-11-10
    • 2015-06-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多