diff options
author | Saku Ytti <saku@ytti.fi> | 2014-03-05 13:54:36 +0200 |
---|---|---|
committer | Saku Ytti <saku@ytti.fi> | 2014-03-05 13:54:36 +0200 |
commit | f8be9c5a3597768128d70209daf4d40e527a7880 (patch) | |
tree | 656a61bee97b11e022fa0d27be38f059c146e18f /lib/oxidized/input/ssh.rb | |
parent | 91abe312526e3bd0cd4927209dbff53976393dde (diff) |
Add AireOS support
Crappy Cisco WLC 5k, much quality, very implementation, such secure
* stop pre_logout from expecting prompt by default
Diffstat (limited to 'lib/oxidized/input/ssh.rb')
-rw-r--r-- | lib/oxidized/input/ssh.rb | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/oxidized/input/ssh.rb b/lib/oxidized/input/ssh.rb index a0a5916..ef15292 100644 --- a/lib/oxidized/input/ssh.rb +++ b/lib/oxidized/input/ssh.rb @@ -23,7 +23,10 @@ module Oxidized @ssh = Net::SSH.start @node.ip, @node.auth[:username], :password => @node.auth[:password], :timeout => CFG.timeout, :paranoid => secure - open_shell @ssh unless @exec + unless @exec + shell_open @ssh + @username ? shell_login : expect(@node.prompt) + end @ssh and not @ssh.closed? end @@ -55,7 +58,7 @@ module Oxidized end end - def open_shell ssh + def shell_open ssh @ses = ssh.open_channel do |ch| ch.on_data do |ch, data| @output << data @@ -68,7 +71,15 @@ module Oxidized end end end - expect @node.prompt + end + + # Cisco WCS has extremely dubious SSH implementation, SSH auth is always + # success, it always opens shell and then run auth in shell. I guess + # they'll never support exec() :) + def shell_login + expect username + cmd @node.auth[:username], password + cmd @node.auth[:password] end def exec state=nil |