Open varac opened 9 years ago
Interesting; I wasn't aware of this. Does vagrant always look for a file named vagrant_private_key in the box, or do you have to specify this in the box's Vagrantfile?
i really not sure about this, and insights from someone who know would be great. i also didn't find any documentation on distributing boxes with keys inside.
I have such box as well. My box includes this Vagrantfile:
Vagrant::Config.run do |config|
# This Vagrantfile is auto-generated by `vagrant package` to contain
# the MAC address of the box. Custom configuration should be placed in
# the actual `Vagrantfile` in this box.
config.vm.base_mac = "080027808080"
end
# Load include vagrant file if it exists after the auto-generated
# so it can override any of the settings
include_vagrantfiille = File.expand_path("../include/_Vagrantfile", __FILE__)
load include_vagrantfile if File.exist?(include_vagrantfile)
Vagrant.configure("2") do |config|
config.ssh.private_key_path = File.expand_path("../vagrant_private_key", __FILE__)
end
I appended this file with the mutate'd Vagrantfile, which looks like created from scratch. That worked.
Content of box directory:
ls -a 1.0.0/virtualbox/
. .. box-disk001.vmdk box.ovf metadata.json Vagrantfile vagrant_private_key
some boxes are distributed with an own private ssh key, like this one (i added the suffix .tgz only to be able to show the content) :
i used this to convert it:
but in the resulting box directory, the vagrant_private_key file is missing:
vagrant ssh falls back to use the /home/varac/.vagrant.d/insecure_private_key, which will not work: