diff options
author | Fauli83 <cpuboni@gmail.com> | 2017-07-02 12:38:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-02 12:38:06 +0200 |
commit | 8ea89e7fdc2e43b050630080535b08cb878fc2a5 (patch) | |
tree | a0d57b3bafd35d759e411b36000add9573cf36fe /lib/oxidized | |
parent | 6ed0d936342d57b0fc21b8357075b9ffa0837156 (diff) |
Update ssh.rb
Diffstat (limited to 'lib/oxidized')
-rw-r--r-- | lib/oxidized/input/ssh.rb | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/oxidized/input/ssh.rb b/lib/oxidized/input/ssh.rb index 858d5cd..27e81e0 100644 --- a/lib/oxidized/input/ssh.rb +++ b/lib/oxidized/input/ssh.rb @@ -24,20 +24,23 @@ 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 + + ssh_opts = { + :port => port.to_i, + :password => @node.auth[:password], :timeout => Oxidized.config.timeout, + :paranoid => secure, + :auth_methods => %w(none publickey password keyboard-interactive), + :number_of_password_prompts => 0, + } + if proxy_host = vars(:ssh_proxy) proxy_command = "ssh " proxy_command += "-o StrictHostKeyChecking=no " unless secure proxy_command += "#{proxy_host} -W %h:%p" proxy = Net::SSH::Proxy::Command.new(proxy_command) + ssh_opts[:proxy] = proxy end - ssh_opts = { - :port => port.to_i, - :password => @node.auth[:password], :timeout => Oxidized.config.timeout, - :paranoid => secure, - :auth_methods => %w(none publickey password keyboard-interactive), - :number_of_password_prompts => 0, - :proxy => proxy, - } + 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) |