Curl 流浪汉不在窗户上工作

Curl 流浪汉不在窗户上工作,curl,vagrant,virtualbox,Curl,Vagrant,Virtualbox,我正在跟踪官方的流浪汉文件 我已在Windows 10 64位处理器上安装了vagrant和virtual box。 在命令提示符下运行这些命令后,我得到: vagrant init hashicorp/precise32 vagrant up 错误如下所示: 正在使用“virtualbox”提供程序启动计算机“默认”。。。 ==>默认值:找不到框“hashicorp/precise32”。正在尝试查找并安装。。。 默认值:框提供程序:virtualbox 默认值:框版本:>=0 找不到“h

我正在跟踪官方的流浪汉文件

我已在Windows 10 64位处理器上安装了vagrant和virtual box。 在命令提示符下运行这些命令后,我得到:

vagrant init hashicorp/precise32
vagrant up
错误如下所示: 正在使用“virtualbox”提供程序启动计算机“默认”。。。 ==>默认值:找不到框“hashicorp/precise32”。正在尝试查找并安装。。。 默认值:框提供程序:virtualbox 默认值:框版本:>=0 找不到“hashicorp/precise32”框,或者 无法在远程目录中访问。如果这是私人的 请验证您是否已通过登录
流浪登录
。另外,请仔细核对姓名。扩大的 URL和错误消息如下所示:

URL:[“”] 错误:SSL证书问题:无法获取本地颁发者证书 详情如下:

curl默认情况下使用“bundle”执行SSL证书验证 颁发证书机构(CA)公钥(CA证书)。如果默认 捆绑文件不足,您可以指定一个备用文件 使用--cacert选项。 如果此HTTPS服务器使用由中表示的CA签名的证书 对于捆绑包,证书验证可能由于错误而失败 证书有问题(可能已过期,或者名称可能已过期) 与URL中的域名不匹配)。 如果要关闭curl对证书的验证,请使用 -k(或--unsecure)选项


如何修复此错误?

如果出现SSL问题,可以尝试使用
--unsecure
选项添加该框

vagrant box add --insecure hashicorp/precise32 hashicorp/precise32
--存在时不安全,如果URL是HTTPS URL,则不会验证SSL证书

如果您有一些未完成的传输,您可能需要清理
~/.vagrant.d/tmp/
文件夹

您还可以下载ssl证书并直接使用它绕过错误

$ vagrant box add --cacert <certificate> box_name
$vagrant box add--cacert box\u name

由于长期禁用SSL验证是一种糟糕的做法,您可以通过将证书添加到嵌入式Ruby和curl的信任链(虽然很痛苦,但可能会自动执行),或者更好地使用添加到较新Vagrant版本的备用CA路径,以正确的方式更正证书颁发
config.vm.box\u download\u ca\u cert
似乎是新设置

手动方式:

The steps are as follows:

Step 1: Obtain the correct trust certificate
Step 2: Locate RubyGems certificate directory in your installation
Step 3: Copy correct trust certificate
Step 4: Profit


Step 1: Obtain the correct trust certificate

We need to download the correct trust certificate, YourCompanyRootCA.pem.
This can probably be obtained from your IT department or by exporting the certificate from your web browser or certificate store (and possibly converting to .pem using OpenSSL).

IMPORTANT: File must have .pem as extension. Browsers like Chrome will try to save it as plain text file. Ensure you change the filename to end with .pem after you have downloaded it.

Step 2: Locate Ruby certificate directory in your installation

In order for us copy this file, we need to know where to put it.

Depending on where you installed Ruby (or Vagrant has embedded it), the directory will be different.

Take for example the default installation of Ruby 2.1.5, placed in C:\Ruby21
Or the Vagrant default of C:\HashiCorp\Vagrant\embedded (or /opt on Linux)
Search for `cacert.pem` or any `*.pem` in those directories.

Step 3: Copy new trust certificate

Now, locate ssl_certs directory (Ruby) and copy the .pem file we obtained from previous step inside. 

It will be listed with other files like AddTrustExternalCARoot.pem.

If you are updating the Vagrant cacert.pem, make a backup copy, then append the entire contents of your new .pem file to the end of the cacert.pem. This should eliminate the warnings from Vagrant's ruby/curl.

您可以将其添加到文件中

config.vm.box_download_insecure=true

这确实是最好的解决办法。为什么安全性必须如此非用户友好?当我们想让某些东西起作用时,使用“不安全”的解决方案就容易多了。有没有一种更为用户友好的方法来实现安全性?遗憾的是,Ruby被开发人员用于各种奇怪的事情,而且通常对一个人有效的东西很少在其他任何人的机器上有效(不管你用什么语言开发,这种情况经常发生)。在本例中,我相信Vagrant可以选择提供其他SSL证书,但我已经很久没有看过了。