FS#51867 - [vagrant] Issue with an embedded certificate
Attached to Project:
Community Packages
Opened by Robert Gonciarz (gonciarz) - Thursday, 17 November 2016, 23:16 GMT
Last edited by Jonathan Steel (jsteel) - Friday, 06 January 2017, 12:44 GMT
Opened by Robert Gonciarz (gonciarz) - Thursday, 17 November 2016, 23:16 GMT
Last edited by Jonathan Steel (jsteel) - Friday, 06 January 2017, 12:44 GMT
|
Details
Description:
Vagrant's embadded ruby version is not actual. The certificate has expired and we are not able to fetch any plugin. In my case I'm trying to install vagrant-libvirt and it's dependency (ruby-libvirt). Downloading https://raw.githubusercontent.com/rubygems/rubygems/master/lib/rubygems/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem to directory: /opt/vagrant/embedded/gems/gems/bundler-1.12.5/lib/bundler/ssl_certs/ workarounds the issue Additional info: * package version(s): 1.8.7-1 * config and/or log files etc. Steps to reproduce: sudo pacman -S vagrant export PATH=/opt/vagrant/embedded/bin:$PATH export GEM_HOME=~/.vagrant.d/gems export GEM_PATH=$GEM_HOME:/opt/vagrant/embedded/gems gem install ruby-libvirt ERROR: Could not find a valid gem 'ruby-libvirt' (>= 0), here is why: 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) |
This task depends upon
docker run -d nfnty/arch-mini tail -f /dev/null
docker exec -it $(docker ps -q -f "ancestor=nfnty/arch-mini") bash
pacman --noconfirm -Syu
pacman --noconfirm -S vagrant
export PATH=/opt/vagrant/embedded/bin:$PATH
export GEM_HOME=~/.vagrant.d/gems
export GEM_PATH=$GEM_HOME:/opt/vagrant/embedded/gems
gem install rails
I've noticed that after running I see the path of default cert file:
ruby -ropenssl -e 'p OpenSSL::X509::DEFAULT_CERT_FILE'
"/build/vagrant-substrate/src/vagrant-installers/vagrant-substrate/staging/embedded/ssl/cert.pem"
After I copied certificate to the mentioned above location I was able to fetch gem:
mkdir -p /build/vagrant-substrate/src/vagrant-installers/vagrant-substrate/staging/embedded/ssl/
cp /opt/vagrant/embedded/gems/gems/bundler-1.12.5/lib/bundler/ssl_certs/GlobalSignRoot.pem /build/vagrant-substrate/src/vagrant-installers/vagrant-substrate/staging/embedded/ssl/cert.pem
Another workaround I've found is to change source's protocol:
gem sources --remove https://rubygems.org
gem sources --add http://rubygems.org
I can recreate the issue installing any gem.
As I mentioned at the beginning, in order to install vagrant-libvirt I have to add several ruby dependencies using Vagrant's embedded env.
Thus I switch from system's ruby to Vagrant's one. When I use system's ruby (2.5.2) I don't have problem with fetching gems.
Do you have any ideas what would be the best solution for fixing the issue other than just closing it?
I've noticed in PKGBUILD another cert file but it seems to be a different from the one provided.
There is also an article on ruby web: http://guides.rubygems.org/ssl-certificate-update/
Btw this problem is more complex. When I run the command:
vagrant plugin install vagrant-libvirt
1) the newest version crashes when trying to build ruby-libvirt-0.7.0
2) and even if you install the plugin, there is another issue. Please take a look at this:
https://wiki.archlinux.org/index.php/Vagrant#vagrant-libvirt
There is a bug: https://github.com/vagrant-libvirt/vagrant-libvirt/issues/541
and as a workaround I have to use embedded ruby games manually.
I must've done some more changes. But the procedure I put in the comment should work. I run minimal arch docker image:
docker run -d nfnty/arch-mini tail -f /dev/null # start container
docker exec -it $(docker ps -q -f "ancestor=nfnty/arch-mini") bash # connect to it
pacman --noconfirm -Syu
pacman --noconfirm -S vagrant wget base-devel
export PATH=/opt/vagrant/embedded/bin:$PATH
export GEM_HOME=~/.vagrant.d/gems
export GEM_PATH=$GEM_HOME:/opt/vagrant/embedded/gems
gem install rails # That won't work now
mkdir -p /build/vagrant-substrate/src/vagrant-installers/vagrant-substrate/staging/embedded/ssl/
cp /opt/vagrant/embedded/gems/gems/bundler-1.12.5/lib/bundler/ssl_certs/GlobalSignRoot.pem /build/vagrant-substrate/src/vagrant-installers/vagrant-substrate/staging/embedded/ssl/cert.pem
gem install rails # cert issue does not appear now