-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
if .vagrant/machines/*/*/private_key exists, config.ssh.private_key_path in the Vagrantfile is ignored #5090
Comments
I guess this is coming at #4967 from a different direction? |
If the I think we need to think about this more. Tagging as a bug to think on. |
PuPHPet implemented its own key generator several months ago, before Vagrant 1.7 came out. It uses the insecure key on initial PuPHPet's solution is more 'powerful' because a custom SSH key is generated even if the host is a Windows machine. This bug breaks puphpet in that the custom SSH key does not exist on initial You can see how this is implemented here: https://github.com/puphpet/puphpet/blob/master/src/Puphpet/Extension/VagrantfileLocalBundle/Resources/views/Vagrantfile.rb.twig#L232 This breaks it because, as you mentioned, it ignores My solution is unfortunately hacky. I check if the custom key has been generated, delete the Vagrant key, replace it with the custom, and go on from there. It would be much cleaner if Vagrant respected |
Per hashicorp/vagrant/issues/5090 as of version 1.7, Vagrant generates a unique private key to replace the insecure key. It only generates this key if `private_key_path` is not set. PuPHPet sets `private_key_path` but only if they custom key exists, which is generated during provisioning on initial `vagrant up`. Vagrant ignores `private_key_path` if `private_key` exists, breaking ability to log in to VM. This replaces the `private_key` with the custom, PuPHPet-generated SSH key.
I agree with what @deltamualpha wrote:
I personally found vagrant's treatment of |
Just want to give this another +1. Ran into the same issue and was confused. |
👍 for:
Especially useful when setting your own private key on a later moment. |
aha. |
Hi, For me the setting works perfect for what it is meant to be - I setup a custom Box with my private key and define it in the private_key_path and it works. |
For me, it only works if in the install script, I delete the private key inside .vagrant. |
Fixed on master! |
:clap |
yay! |
This is just my guess based on behavior, but I've been going nuts trying to track down issues here and this seems like the root of it.
I was able to ssh into my virtualbox environment using
vagrant ssh --plain
and another key I knew was in theauthorized_keys
file, as well as set as theconfig.ssh.private_key_path
, but normalvagrant ssh
would not work. Vagrant had generated a private key, however, that I had removed (via configuration management) fromauthorized_keys
. Deleting the key itself from the.vagrant
directory for the environment suddenly restored my ability to log in.Additionally, having
~/.vagrant.d/insecure_private_key
in yourconfig.ssh.private_key_path
array means that Vagrant will continue to try and generate and insert a fresh generated key, even if it's only there as a fallback option for bootstrapping.Vagrant should never discard explicit user settings in a Vagrantfile.
The text was updated successfully, but these errors were encountered: