Merge pull request #10143 from chrisroberts/f-rsync-host-key

Check :verify_host_key value for :never or if falsey
This commit is contained in:
Chris Roberts 2018-08-24 14:47:00 -07:00 committed by GitHub
commit 636b1c9702
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 1 deletions

View File

@ -101,7 +101,7 @@ module VagrantPlugins
end
# 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 += [
"-o", "StrictHostKeyChecking=no",
"-o", "UserKnownHostsFile=/dev/null"]

View File

@ -263,6 +263,26 @@ describe VagrantPlugins::SyncedFolderRSync::RsyncHelper do
subject.rsync_single(machine, ssh_info, opts)
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
ssh_info[:keys_only] = false