Check :verify_host_key value for :never or if falsey

This commit is contained in:
Chris Roberts 2018-08-24 14:06:04 -07:00
parent 38d48ba153
commit d48b95ffaf
2 changed files with 21 additions and 1 deletions

View File

@ -101,7 +101,7 @@ module VagrantPlugins
end end
# no strict hostkey checking unless paranoid # no strict hostkey checking unless paranoid
if ! ssh_info[:verify_host_key] if ssh_info[:verify_host_key] == :never || !ssh_info[:verify_host_key]
rsh += [ rsh += [
"-o", "StrictHostKeyChecking=no", "-o", "StrictHostKeyChecking=no",
"-o", "UserKnownHostsFile=/dev/null"] "-o", "UserKnownHostsFile=/dev/null"]

View File

@ -263,6 +263,26 @@ describe VagrantPlugins::SyncedFolderRSync::RsyncHelper do
subject.rsync_single(machine, ssh_info, opts) subject.rsync_single(machine, ssh_info, opts)
end end
it "includes StrictHostKeyChecking, and UserKnownHostsFile when verify_host_key is false" do
expect(Vagrant::Util::Subprocess).to receive(:execute).with(any_args) { |*args|
expect(args[9]).to include('StrictHostKeyChecking')
expect(args[9]).to include('UserKnownHostsFile')
}.and_return(result)
subject.rsync_single(machine, ssh_info, opts)
end
it "includes StrictHostKeyChecking, and UserKnownHostsFile when verify_host_key is :never" do
ssh_info[:verify_host_key] = :never
expect(Vagrant::Util::Subprocess).to receive(:execute).with(any_args) { |*args|
expect(args[9]).to include('StrictHostKeyChecking')
expect(args[9]).to include('UserKnownHostsFile')
}.and_return(result)
subject.rsync_single(machine, ssh_info, opts)
end
it "omits IdentitiesOnly with keys_only = false" do it "omits IdentitiesOnly with keys_only = false" do
ssh_info[:keys_only] = false ssh_info[:keys_only] = false