我可以让 Vagrant 保留不安全的密钥吗?

Kit*_*nde 6 vagrant

如果 Vagrant 检测到不安全的密钥,它似乎会生成一个新的密钥对。是否有可能阻止这种行为?

Sad*_*nny 11

# By default, Vagrant 1.7+ automatically inserts a different
# insecure keypair for each new VM created. The easiest way
# to use the same keypair for all the machines is to disable
# this feature and rely on the legacy insecure key.
config.ssh.insert_key = false
Run Code Online (Sandbox Code Playgroud)

例如......我目前的“快速测试” Vagrantfile 看起来像:

C:\Users\monsterkill\vagrant>cat Vagrantfile
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
    config.ssh.insert_key = false
        config.vm.define "vagrant1" do |vagrant1|
                vagrant1.vm.box = "ubuntu/trusty64"
                vagrant1.vm.network "forwarded_port", guest: 80, host: 8080
                vagrant1.vm.network "forwarded_port", guest: 443, host: 8443
                vagrant1.vm.network "private_network", ip: "192.168.33.10"
        end
end
Run Code Online (Sandbox Code Playgroud)