[Help Wanted!] Trust Trellis' self-signed certificates with single command

Trust Trellis’ self-signed certificates with single command because ain’t nobody got time for that.

  1. Install vagrant-trellis-cert
$ vagrant plugin install vagrant-trellis-cert
  1. Run that single command at project root (same level with ansible.cfg)
$ vagrant trellis-cert trust
www.typist.dev certificate imported successfully
www.example.dev certificate imported successfully
  1. I told you… single command…

How about not even a single command?

If the vagrant-triggers plugin is installed, we can run the command on Vagrant state changes like vagrant provision. Add these lines into Trellis’ Vagrantfile:

# Vagrantfile

# Some lines of code...

Vagrant.configure('2') do |config|
  # Some more lines of code later...

  config.trigger.after :provision, :stdout => true do
    run "vagrant trellis-cert trust"

Help Wanted!

So far, this plugin only works on macOS. Pull requests are welcome.


Very cool!

FYI vagrant-triggers is incompatible with Vagrant as of version 1.9.6 or 1.9.7. Appears to be abandoned, too, so I wouldn’t count on it getting updated anytime soon :expressionless:

This is awesome! Bummer vagrant-triggers doesn’t work with recent Vagrant, but this could save a lot of headache with local HTTPS :ok_hand:

Bumping to say thanks for this and hopefully bring some more visibility to this very helpful utility :+1:

1 Like

Hmm, I seem to get vagrant plugin inception:

Ah ok, so I should run vagrant plugin install vagrant-trellis-cert in ~/. I was trying to run it in sites/mysite.com/trellis.

Then vagrant trellis-cert trust in sites/mysite.com/trellis gives me sweeet sweeet success:

I’m sure this would have been obvious to everyone else…

Interesting. I didn’t know vagrant plugin install at different directories makes a different.

For those who failed to install, try this as well https://github.com/TypistTech/vagrant-trellis-cert/issues/42

Running into an issue with a similar mentality, but can you please confirm that you don’t install this into the trellis directory of your project folder? I get the success message within the trellis folder that the site was added, but chrome still shows “Not Secure” in the address bar.

I installed in ~/, and tried vagrant trellis-cert trust and it mentioned “failed at an early stage”.

Many thanks!

“failed at an early stage”.

Ususally it happens after upgrading vagrant. Real reason is unknown, I just “reset/reinstall” all vagrant plugins (https://github.com/hashicorp/vagrant/issues/8054).

To clarify, install and use it like so (note the $ cd xxx):

$ cd ~
$ vagrant plugin install vagrant-trellis-cert
$ cd /path/to/my/trellis
$ vagrant trellis-cert trust

Open an issue if chrome still shows “Not Secure”.
Note: It is known that this plugin won’t work on FireFox because FireFox has its own “trust system” instead of using macOS keychain.

To be honest, I don’t use vagrant for new projects anymore because vagrant gives me more trouble than benefits.