summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenver Abrey <denvera@gmail.com>2016-10-17 20:42:10 +0200
committerDenver Abrey <denvera@gmail.com>2016-10-17 20:42:10 +0200
commit75534fa493013a5e563877ffc05eca6f4372999c (patch)
tree96ba968599288ebf1f074bb0f435a895da7caf45
parent22755169b513ebde33de2704afd2f7a0b366723a (diff)
Use variable vars(:ssh_keys) for private key authentication
-rw-r--r--lib/oxidized/input/ssh.rb5
-rw-r--r--lib/oxidized/node.rb1
2 files changed, 2 insertions, 4 deletions
diff --git a/lib/oxidized/input/ssh.rb b/lib/oxidized/input/ssh.rb
index 32f4e40..15f1427 100644
--- a/lib/oxidized/input/ssh.rb
+++ b/lib/oxidized/input/ssh.rb
@@ -23,7 +23,6 @@ module Oxidized
secure = Oxidized.config.input.ssh.secure
@log = File.open(Oxidized::Config::Log + "/#{@node.ip}-ssh", 'w') if Oxidized.config.input.debug?
port = vars(:ssh_port) || 22
- keys = node.auth[:private_key].is_a?(Array) ? @node.auth[:private_key] : [@node.auth[:private_key]]
if proxy_host = vars(:ssh_proxy)
proxy = Net::SSH::Proxy::Command.new("ssh #{proxy_host} -W %h:%p")
end
@@ -34,9 +33,9 @@ module Oxidized
:auth_methods => %w(none publickey password keyboard-interactive),
:number_of_password_prompts => 0,
:proxy => proxy,
- :keys => keys
}
- 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 dc44df7..b13ce0e 100644
--- a/lib/oxidized/node.rb
+++ b/lib/oxidized/node.rb
@@ -132,7 +132,6 @@ module Oxidized
{
username: resolve_key(:username, opt),
password: resolve_key(:password, opt),
- private_key: resolve_key(:private_key, opt),
}
end