Fixing PuPHPet/Vagrant SSL errors with rubygems
Trying to update dependencies in a PuPHPet/Vagrant virtual machine using
vagrant provision, but getting SSL errors when it tries to install gems?
$ vagrant provision ==> netlift-web: Running provisioner: shell... [...] Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=error: certificate verify failed (https://api.rubygems.org/specs.4.8.gz) [...]
The issue is explained on rubygems.org, but basically, the CA Certs included in the PuPHPet VM you are using do not include the required CA cert (GlobalSign Root CA).
The fix is quite easy:
$ vagrant ssh # cd $(dirname `/opt/puppetlabs/puppet/bin/gem which rubygems`)/rubygems/ssl_certs/ # sudo wget https://raw.githubusercontent.com/rubygems/rubygems/master/lib/rubygems/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem
Then just retry your
vagrant provision. Voilà!