Merge pull request #5414 from inspec/cw/ssh_conf_first_value

This commit is contained in:
Clinton Wolfe 2021-02-23 12:05:44 -05:00 committed by GitHub
commit b425f1d6b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 1 deletions

View file

@ -39,7 +39,7 @@ module Inspec::Resources
def convert_hash(hash)
new_hash = {}
hash.each do |k, v|
new_hash[k.downcase] = v
new_hash[k.downcase] ||= v
end
new_hash
end

View file

@ -4,3 +4,6 @@ Host *
SendEnv LANG LC_*
HashKnownHosts yes
GSSAPIAuthentication no
HostBasedAuthentication yes
HostbasedAuthentication no
HostbasedAuthentication no

View file

@ -18,6 +18,11 @@ describe "Inspec::Resources::SshConfig" do
_(resource.gssapiauthentication).must_equal "no"
_(resource.GSSAPIAuthentication).must_equal "no"
end
it "uses the first value encountered" do
resource = load_resource("ssh_config")
_(resource.HostBasedAuthentication).must_equal "yes"
end
end
describe "sshd_config" do