配置 Vagrant CA 证书

问题描述 投票:0回答:1

我在企业代理服务器和自签名 CA 证书后面执行 Vagrant 命令时遇到问题。我已经配置了环境变量 HTTP_PROXY、HTTPS_PROXY 和 HTTP_NO_PROXY 变量。

我有一个包含所有公司证书的 Java 密钥库。我使用了 keytool 命令的 -exportcert 选项和许多选项。我也使用了 openssl 命令和许多选项,并将生成的文件放置在 Vagrant 安装中嵌入式 Ruby 目录中的多个位置,但没有成功。

我已经阅读了很多包含有关配置 Ruby 和curl 的信息的网站,但在让 Vagrant 命令正常工作方面还没有取得任何成功。我找到的所有帖子都集中在 Ruby 和curl 选项上,我不明白如何使用 Vagrant,其中包括将 Ruby 作为 Vagrant 的嵌入式组件。

请提供有关如何正确从 Java 密钥存储中导出证书以及如何转换它们并放置生成的文件的说明,以便 Vagrant 能够成功地通过公司代理与互联网进行通信。

Windows 7 上的 Vagrant 1.9.5

Vagrant安装目录C:\Apps\Vagrant\

C:\WorkArea> vagrant plugin install vagrant.proxyconf

ERROR:  SSL verification error at depth 3: self signed certificate in certificate chain (19)
ERROR:  Root certificate is not trusted (/C=US/O=xxx xxx/OU=xxx xxx Certification Authority/CN=xxx xxx Root Certification Authority 01 G2)  
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://api.rubygems.org/specs.4.8.gz)

C:\WorkArea> vagrant up

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'puppetlabs/ubuntu-16.04-64-puppet' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
The box 'puppetlabs/ubuntu-16.04-64-puppet' could not be found or
could not be accessed in the remote catalog. If this is a private
box on HashiCorp's Atlas, please verify you're logged in via
`vagrant login`. Also, please double-check the name. The expanded
URL and error message are shown below:
URL: ["https://atlas.hashicorp.com/puppetlabs/ubuntu-16.04-64-puppet"]
Error: SSL certificate problem: self signed certificate in certificate chain
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). If the default
bundle file isn't adequate, 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.
ruby ssl vagrant
1个回答
19
投票

您似乎没有将根证书放置在正确的位置

转到安装 Vagrant 的目录,找到文件

embedded\cacert.pem
,然后将公司证书的内容附加到该文件中。保存并重试该操作。如果您正确导出了根 CA 证书,那么 Vagrant 应该会读取它们并允许连接。

如果通过合并文件仍然无法使其工作,请尝试在环境中运行

vagrant
SSL_CERT_FILE=/path/to/your/certs.pem
。这将允许您验证您是否已正确导出公司证书。

根证书的路径、文件和公司证书的行结束符、如何配置

SSL_CERT_FILE
以及如何构造
SSL_CERT_FILE
的值将因平台而异。

© www.soinside.com 2019 - 2024. All rights reserved.