Techioz Blog

Vagrant CA 証明書の構成

概要

企業プロキシ サーバーおよび自己署名 CA 証明書の背後で Vagrant コマンドを実行すると問題が発生します。環境変数 HTTP_PROXY、HTTPS_PROXY、および HTTP_NO_PROXY 変数を構成しました。

すべての企業証明書を含む Java キー ストアがあります。 keytool コマンドの -exportcert オプションを多数のオプションとともに使用しました。 openssl コマンドを多数のオプションとともに使用し、結果のファイルを Vagrant インストール内の埋め込み Ruby ディレクトリ内の複数の場所に配置しましたが、成功しませんでした。

Rubyとcurlの設定に関する情報を含む多くのサイトを読みましたが、Vagrantコマンドを機能させることに成功しませんでした。私が見つけたすべての投稿は、Ruby と、Vagrant の組み込みコンポーネントとして Ruby を含む Vagrant で利用する方法が理解できないカールのオプションに焦点を当てています。

Vagrant が企業プロキシを介してインターネットに正常に通信できるように、Java キー ストアから証明書を正しくエクスポートし、必要に応じて証明書を変換して結果のファイルを配置する方法についての手順を提供してください。

Windows 7 上の Vagrant 1.9.5

Vagrant インストール ディレクトリ C:

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.

解決策

ルート証明書を正しい場所に配置していないようです。

Vagrant をインストールしたディレクトリに移動し、埋め込まれているファイルを見つけます

ファイルを結合しても機能しない場合は、環境内で SSL_CERT_FILE=/path/to/your/certs.pem を指定して vagrant を実行してみてください。これにより、企業証明書が適切にエクスポートされたことを検証できます。

ルート証明書へのパス、ファイルと企業証明書の行末、SSL_CERT_FILE の構成方法、および SSL_CERT_FILE の値の構造方法は、プラットフォームによって異なります。