Merge pull request #10182 from chrisroberts/f-ssh-config

Check verify_host_key for falsey or :never values when generating ssh config
This commit is contained in:
Brian Cain 2018-09-07 10:43:26 -07:00 committed by GitHub
commit c589a667ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View File

@ -2,7 +2,7 @@ Host <%= host_key %>
HostName <%= ssh_host %>
User <%= ssh_user %>
Port <%= ssh_port %>
<% if ! verify_host_key -%>
<% if ! verify_host_key || verify_host_key == :never -%>
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
<% end -%>

View File

@ -151,5 +151,19 @@ Host #{machine.name}
subject.execute
expect(output).to include('IdentityFile /home/vagrant/home.key')
end
it "handles verify_host_key :never value" do
allow(machine).to receive(:ssh_info) { ssh_info.merge(verify_host_key: :never) }
output = ""
allow(subject).to receive(:safe_puts) do |data|
output += data if data
end
subject.execute
expect(output).to include('StrictHostKeyChecking ')
expect(output).to include('UserKnownHostsFile ')
end
end
end