Varying-Vagrant-Vagrants / VVV

An open source Vagrant configuration for developing with WordPress
https://varyingvagrantvagrants.org
MIT License
4.55k stars 849 forks source link

Bug: key for Mongo db expired ; causing provisioning to fail. #2713

Closed skorasaurus closed 1 week ago

skorasaurus commented 2 weeks ago

Are you using the latest stable or develop branch version of VVV?

Yes (develop), last commit was 8e59717844251c9d887a3a392b92a22f9c19e4c8 2024-06-16

Is it a new VVV, or an existing VVV that used to work?

Existing, worked but now broken

Did you use a CustomFile?

No.

Whats the problem?

Similar to #2709;

I made some configurations to my config.yaml so I reprovisioned for the first time in a few months; and even though I have tideways and mongodb commented out in my config.yaml; I receive an error that their key has expired.

The mongodb key has expired for Ubuntu Focal (20.04) which vvv uses (Ref https://www.mongodb.com/community/forums/t/invalid-signature-on-ubuntu-focal-mongo-4-4-repo/283753 https://travis-ci.community/t/travis-focal-ubuntu-image-uses-now-expired-mongodb-4-4-package/14293

The key file for mongodb is not stored in the database but is stored in provision/extensions/core/mongodb

How do we reproduce it?

  1. Reprovision your machine.

What is the output of vagrant status

config.yaml available at https://gist.github.com/skorasaurus/5e431fadaffd452877c65a63b5d4e77f

Ubuntu 20.04.6 LTS

myusername@pluto:~/vvv$ vagrant up --provision
__ __ __ __
\ V\ V\ V / v3.14.0 Ruby:2.7.4, Path:"/home/myusername/vvv"
 \_/\_/\_/  git::develop(8e597178)

Platform: linux shell:/bin/bash systemd  vagrant-goodhosts vagrant-vbguest CaseSensitiveFS shared_db_folder_disabled
Vagrant: v2.2.18, virtualbox: v6.1.32

Which Operating System are you using?

Linux

Which provider are you using?

VirtualBox 6

tomjn commented 2 weeks ago

Is there an updated key? MongoDB shouldn't be necessary for Tideways/XHProf which is what we added it for.

We did recently need to update the Nginx signing key, it should be enough to drop the new file in, this is the commit that modified the provisioner to check for the old key:

https://github.com/Varying-Vagrant-Vagrants/VVV/commit/d9d016ac1c21f6f967e0e9c3e6615ab6d04d4a4b

Also your issue mentioned a vagrant customfile but the gist is your config.yml, was that a mistake?

skorasaurus commented 2 weeks ago

Thanks so much for the prompt response.

Is there an updated key? MongoDB shouldn't be necessary for Tideways/XHProf which is what we added it for.

I believe so, looking into this right now. UPDATE: the key https://www.mongodb.org/static/pgp/server-4.4.asc on https://www.mongodb.com/docs/v4.4/tutorial/install-mongodb-on-ubuntu/ has a different file contents than the server-4.4.asc that had existed at /provision/extensions/core/mongodb

Also your issue mentioned a vagrant customfile but the gist is your config.yml, was that a mistake?

Yes, that was a mistake; not using a vagrant customfile.

We did recently need to update the Nginx signing key, it should be enough to drop the new file in, this is the commit that modified the provisioner to check for the old key:

I did run git checkout develop; git pull; vagrant up --provision before making the issue.

skorasaurus commented 2 weeks ago

I was able to resolve this by the following although there's a couple other different ways possibly to fix this:

  1. vagrant up && vagrant ssh 2..Delete the existing expired Mongodb key 2a. while in the vagrant machine, sudo apt-key list; note letter/number combination on or above the line that states mongodb e.g. "D4CC 8597 4C31 396B 18B3 6837 F615 564B A5C7 FF72" (this will NOT be the exact combination) 2b. sudo apt-get del "the key combination"
  2. delete the entry sudo rm -rf /etc/apt/sources.list.d/mongodb-org.list (NOTE, this may not be necessary).
  3. import the new public key for mongodb 4a. follow steps 1-2 listed on https://www.mongodb.com/docs/v4.4/tutorial/install-mongodb-on-ubuntu/ ; Import the public key used by the package management system and Create a list file for MongoDB.
Install MongoDB Community Edition on Ubuntu - MongoDB Manual v4.4
tomjn commented 2 weeks ago

https://github.com/Varying-Vagrant-Vagrants/vvv-utilities/tree/master/mongodb is the provisioner that needs changing

These lines specifically:

https://github.com/Varying-Vagrant-Vagrants/vvv-utilities/blob/master/mongodb/provision.sh#L29-L40

Note this only affects people who used the mongodb extension/utility or Tideways

GitHub
vvv-utilities/mongodb at master · Varying-Vagrant-Vagrants/vvv-utilities
Official VVV extensions. Contribute to Varying-Vagrant-Vagrants/vvv-utilities development by creating an account on GitHub.
GitHub
vvv-utilities/mongodb/provision.sh at master · Varying-Vagrant-Vagrants/vvv-utilities
Official VVV extensions. Contribute to Varying-Vagrant-Vagrants/vvv-utilities development by creating an account on GitHub.
tomjn commented 2 weeks ago

@skorasaurus this PR attempts to auto-remove the old key, and uses the newer key: https://github.com/Varying-Vagrant-Vagrants/vvv-utilities/pull/113 can you take a look?

tomjn commented 1 week ago

I'm going to close this out, the PRs been merged and things are looking alright.

If you're reading this and you're on the latest develop branch with this issue comment to reopen and I'll take another look