diff options
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | lib/oxidized/input/ssh.rb | 18 | ||||
-rw-r--r-- | lib/oxidized/model/fortios.rb | 5 | ||||
-rw-r--r-- | lib/oxidized/model/mtrlrfs.rb | 35 |
4 files changed, 55 insertions, 6 deletions
@@ -79,6 +79,7 @@ Oxidized is a network device configuration backup tool. It's a RANCID replacemen * IPOS (former SEOS) * Extreme Networks * XOS + * WM * F5 * TMOS * Force10 @@ -96,6 +97,8 @@ Oxidized is a network device configuration backup tool. It's a RANCID replacemen * ScreenOS (Netscreen) * Mikrotik * RouterOS + * Motorola + * RFS * MRV * MasterOS * Opengear diff --git a/lib/oxidized/input/ssh.rb b/lib/oxidized/input/ssh.rb index e7296b5..7ffdd36 100644 --- a/lib/oxidized/input/ssh.rb +++ b/lib/oxidized/input/ssh.rb @@ -26,12 +26,18 @@ module Oxidized if proxy_host = vars(:proxy) proxy = Net::SSH::Proxy::Command.new("ssh #{proxy_host} nc %h %p") end - @ssh = Net::SSH.start(@node.ip, @node.auth[:username], :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 = { + :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[:kex] = vars(:ssh_kex).split(/,\s*/) if vars(:ssh_kex) + ssh_opts[:encryption] = vars(:ssh_encryption).split(/,\s*/) if vars(:ssh_encryption) + + @ssh = Net::SSH.start(@node.ip, @node.auth[:username], ssh_opts) unless @exec shell_open @ssh begin diff --git a/lib/oxidized/model/fortios.rb b/lib/oxidized/model/fortios.rb index 3515b46..92add0e 100644 --- a/lib/oxidized/model/fortios.rb +++ b/lib/oxidized/model/fortios.rb @@ -4,6 +4,11 @@ class FortiOS < Oxidized::Model prompt /^([-\w\.]+(\s[\(\w\-\.\)]+)?\~?\s?[#>]\s?)$/ + expect /^--More--\s$/ do |data, re| + send ' ' + data.sub re, '' + end + cmd :all do |cfg, cmdstring| new_cfg = comment "COMMAND: #{cmdstring}\n" new_cfg << cfg.each_line.to_a[1..-2].map { |line| line.gsub(/(conf_file_ver=)(.*)/, '\1<stripped>\3') }.join diff --git a/lib/oxidized/model/mtrlrfs.rb b/lib/oxidized/model/mtrlrfs.rb new file mode 100644 index 0000000..3931a5b --- /dev/null +++ b/lib/oxidized/model/mtrlrfs.rb @@ -0,0 +1,35 @@ +class mtrlrfs < Oxidized::Model + + # Motorola RFS/Extreme WM + + comment '# ' + + cmd :all do |cfg| + # xos inserts leading \r characters and other trailing white space. + # this deletes extraneous \r and trailing white space. + cfg.each_line.to_a[1..-2].map{|line|line.delete("\r").rstrip}.join("\n") + "\n" + end + + cmd 'show version' do |cfg| + comment cfg + end + + cmd 'show licenses' do |cfg| + comment cfg + end + + cmd 'show running-config' + + cfg :telnet do + username /^login:/ + password /^\r*password:/ + end + + cfg :telnet, :ssh do + post_login 'terminal length 0' + pre_logout 'exit' + pre_logout 'n' + end + +end + |