summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorytti <saku@ytti.fi>2016-10-17 11:54:57 -0700
committerGitHub <noreply@github.com>2016-10-17 11:54:57 -0700
commit1015fc4db5bdef72db5763036460037e06d9b7e5 (patch)
treedc7e3d5d4e9ccc1b1512f1f466e2d901fc49f557
parent18709601e55c8b3a610629aeae773c2233a928cd (diff)
parent75534fa493013a5e563877ffc05eca6f4372999c (diff)
Merge pull request #588 from denvera/master
Add key authentication to ssh input
-rw-r--r--lib/oxidized/input/ssh.rb5
-rw-r--r--lib/oxidized/node.rb4
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/oxidized/input/ssh.rb b/lib/oxidized/input/ssh.rb
index c0b7cf9..15f1427 100644
--- a/lib/oxidized/input/ssh.rb
+++ b/lib/oxidized/input/ssh.rb
@@ -32,9 +32,10 @@ module Oxidized
:paranoid => secure,
:auth_methods => %w(none publickey password keyboard-interactive),
:number_of_password_prompts => 0,
- :proxy => proxy
+ :proxy => proxy,
}
- ssh_opts[:kex] = vars(:ssh_kex).split(/,\s*/) if vars(:ssh_kex)
+ ssh_opts[:keys] = vars(:ssh_keys).is_a?(Array) ? vars(:ssh_keys) : [vars(:ssh_keys)] if vars(:ssh_keys)
+ ssh_opts[:kex] = vars(:ssh_kex).split(/,\s*/) if vars(:ssh_kex)
ssh_opts[:encryption] = vars(:ssh_encryption).split(/,\s*/) if vars(:ssh_encryption)
Oxidized.logger.debug "lib/oxidized/input/ssh.rb: Connecting to #{@node.name}"
diff --git a/lib/oxidized/node.rb b/lib/oxidized/node.rb
index c93a16a..b13ce0e 100644
--- a/lib/oxidized/node.rb
+++ b/lib/oxidized/node.rb
@@ -130,8 +130,8 @@ module Oxidized
def resolve_auth opt
# Resolve configured username/password
{
- username: resolve_key(:username, opt),
- password: resolve_key(:password, opt),
+ username: resolve_key(:username, opt),
+ password: resolve_key(:password, opt),
}
end