oxidized 0.20.0 → 0.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/Gemfile.lock +1 -1
  4. data/README.md +135 -865
  5. data/docs/Configuration.md +186 -0
  6. data/docs/Hooks.md +143 -0
  7. data/docs/Outputs.md +190 -0
  8. data/docs/Ruby-API.md +115 -0
  9. data/docs/Sources.md +110 -0
  10. data/docs/Supported-OS-Types.md +149 -0
  11. data/docs/VRP-Huawei.md +27 -0
  12. data/extra/oxidized-report-git-commits +21 -40
  13. data/extra/oxidized-ubuntu.haproxy +45 -0
  14. data/extra/oxidized.service +4 -0
  15. data/lib/oxidized/hook.rb +1 -0
  16. data/lib/oxidized/hook/exec.rb +0 -1
  17. data/lib/oxidized/input/ssh.rb +11 -8
  18. data/lib/oxidized/model/acsw.rb +67 -0
  19. data/lib/oxidized/model/aen.rb +20 -0
  20. data/lib/oxidized/model/alteonos.rb +60 -0
  21. data/lib/oxidized/model/asa.rb +53 -18
  22. data/lib/oxidized/model/asyncos.rb +49 -0
  23. data/lib/oxidized/model/audiocodes.rb +32 -0
  24. data/lib/oxidized/model/boss.rb +76 -0
  25. data/lib/oxidized/model/ciscosma.rb +45 -0
  26. data/lib/oxidized/model/ciscosmb.rb +6 -1
  27. data/lib/oxidized/model/coriantgroove.rb +30 -0
  28. data/lib/oxidized/model/dlink.rb +1 -0
  29. data/lib/oxidized/model/enterasys.rb +30 -0
  30. data/lib/oxidized/model/fiberdriver.rb +1 -1
  31. data/lib/oxidized/model/fortios.rb +3 -1
  32. data/lib/oxidized/model/ftos.rb +2 -0
  33. data/lib/oxidized/model/hirschmann.rb +41 -0
  34. data/lib/oxidized/model/hpemsa.rb +13 -0
  35. data/lib/oxidized/model/ios.rb +2 -2
  36. data/lib/oxidized/model/iosxr.rb +1 -0
  37. data/lib/oxidized/model/ipos.rb +7 -1
  38. data/lib/oxidized/model/ironware.rb +4 -1
  39. data/lib/oxidized/model/netgear.rb +12 -4
  40. data/lib/oxidized/model/panos.rb +1 -1
  41. data/lib/oxidized/model/planet.rb +2 -1
  42. data/lib/oxidized/model/powerconnect.rb +5 -0
  43. data/lib/oxidized/model/procurve.rb +13 -0
  44. data/lib/oxidized/model/routeros.rb +12 -5
  45. data/lib/oxidized/model/sgos.rb +46 -0
  46. data/lib/oxidized/model/ucs.rb +31 -0
  47. data/lib/oxidized/model/voss.rb +12 -3
  48. data/lib/oxidized/model/vrp.rb +6 -0
  49. data/lib/oxidized/model/weos.rb +22 -0
  50. data/lib/oxidized/model/xos.rb +4 -0
  51. data/lib/oxidized/node.rb +4 -2
  52. data/lib/oxidized/nodes.rb +1 -0
  53. data/lib/oxidized/version.rb +1 -1
  54. data/lib/oxidized/worker.rb +23 -2
  55. data/oxidized.gemspec +1 -1
  56. metadata +54 -46
@@ -0,0 +1,45 @@
1
+ class CiscoSMA < Oxidized::Model
2
+
3
+ # SMA prompt "mail.example.com> "
4
+ prompt /^\r*([-\w. ]+\.[-\w. ]+\.[-\w. ]+[#>]\s+)$/
5
+ comment '! '
6
+
7
+ # Select passphrase display option
8
+ expect /using loadconfig command\. \[Y\]\>/ do |data, re|
9
+ send "y\n"
10
+ data.sub re, ''
11
+ end
12
+
13
+ # handle paging
14
+ expect /-Press Any Key For More-+.*$/ do |data, re|
15
+ send " "
16
+ data.sub re, ''
17
+ end
18
+
19
+ cmd 'version' do |cfg|
20
+ comment cfg
21
+ end
22
+
23
+ cmd 'showconfig' do |cfg|
24
+ #Delete hour and date which change each run
25
+ #cfg.gsub! /\sCurrent Time: \S+\s\S+\s+\S+\s\S+\s\S+/, ' Current Time:'
26
+ # Delete select passphrase display option
27
+ cfg.gsub! /Do you want to mask the password\? Files with masked passwords cannot be loaded/, ''
28
+ cfg.gsub! /^\s+y/, ''
29
+ # Delete space
30
+ cfg.gsub! /\n\s{25}/, ''
31
+ # Delete after line
32
+ cfg.gsub! /([\/\-,.\w><@]+)(\s{27})/,"\\1"
33
+ # Add a carriage return
34
+ cfg.gsub! /([\/\-,.\w><@]+)(\s{6,8})([\/\-,.\w><@]+)/,"\\1\n\\2\\3"
35
+ # Delete prompt
36
+ cfg.gsub! /^\r*([-\w. ]+\.[-\w. ]+\.[-\w. ]+[#>]\s+)$/, ''
37
+ cfg
38
+
39
+ end
40
+
41
+ cfg :ssh do
42
+ pre_logout "exit"
43
+ end
44
+
45
+ end
@@ -1,6 +1,6 @@
1
1
  class CiscoSMB < Oxidized::Model
2
2
 
3
- # Cisco Small Business 200, 300, 500, and ESW2 series switches
3
+ # Cisco Small Business 300, 500, and ESW2 series switches
4
4
  # http://www.cisco.com/c/en/us/support/switches/small-business-300-series-managed-switches/products-release-notes-list.html
5
5
 
6
6
  prompt /^\r?([\w.@()-]+[#>]\s?)$/
@@ -16,12 +16,17 @@ class CiscoSMB < Oxidized::Model
16
16
  cmd :secret do |cfg|
17
17
  cfg.gsub! /^(snmp-server community).*/, '\\1 <configuration removed>'
18
18
  cfg.gsub! /username (\S+) privilege (\d+) (\S+).*/, '<secret hidden>'
19
+ cfg.gsub! /^(encrypted radius-server key).*/, '\\1 <configuration removed>'
19
20
  cfg
20
21
  end
21
22
 
22
23
  cmd 'show version' do |cfg|
23
24
  comment cfg
24
25
  end
26
+
27
+ cmd 'show bootvar' do |cfg|
28
+ comment cfg
29
+ end
25
30
 
26
31
  cmd 'show running-config' do |cfg|
27
32
  cfg = cfg.each_line.to_a[0..-1].join
@@ -0,0 +1,30 @@
1
+ class CoriantGroove < Oxidized::Model
2
+
3
+ comment '# '
4
+
5
+ prompt /^(\w+@.*>\s*)$/
6
+
7
+ cmd :all do |cfg|
8
+ cfg.each_line.to_a[1..-3].map{|line|line.delete("\r").rstrip}.join("\n") + "\n"
9
+ end
10
+
11
+ cmd 'show inventory' do |cfg|
12
+ cfg = cfg.each_line.to_a[0..-2].join
13
+ comment cfg
14
+ end
15
+
16
+ cmd 'show softwareload' do |cfg|
17
+ cfg = cfg.each_line.to_a[0..-2].join
18
+ comment cfg
19
+ end
20
+
21
+ cmd 'show config | display commands' do |cfg|
22
+ cfg.each_line.to_a[1..-1].join
23
+ end
24
+
25
+ cfg :ssh do
26
+ post_login 'set -f cli-config cli-columns 65535'
27
+ pre_logout 'quit -f'
28
+ end
29
+
30
+ end
@@ -15,6 +15,7 @@ class Dlink < Oxidized::Model
15
15
  end
16
16
 
17
17
  cmd 'show switch' do |cfg|
18
+ cfg.gsub! /^System\ Uptime\s.+/, '' # Omit constantly changing uptime info
18
19
  comment cfg
19
20
  end
20
21
 
@@ -0,0 +1,30 @@
1
+ class Enterasys < Oxidized::Model
2
+
3
+ # Enterasys B3/C3 models #
4
+
5
+ prompt /^.+\w\(su\)->\s?$/
6
+
7
+ comment '!'
8
+
9
+ cmd :all do |cfg|
10
+ cfg.each_line.to_a[2..-3].map{|line|line.delete("\r").rstrip}.join("\n") + "\n"
11
+ end
12
+
13
+ cmd 'show system hardware' do |cfg|
14
+ comment cfg
15
+ end
16
+
17
+ cmd 'show config' do |cfg|
18
+ cfg.gsub! /^This command shows non-default configurations only./, ''
19
+ cfg.gsub! /^Use 'show config all' to show both default and non-default configurations./, ''
20
+ cfg.gsub! /^!|#.*/, ''
21
+ cfg.gsub! /^$\n/, ''
22
+
23
+ cfg
24
+ end
25
+
26
+ cfg :ssh do
27
+ pre_logout 'exit'
28
+ end
29
+
30
+ end
@@ -13,7 +13,7 @@ class FiberDriver < Oxidized::Model
13
13
  cfg.each_line.to_a[3..-1].join
14
14
  cfg.gsub! /^Building configuration.*$/, ''
15
15
  cfg.gsub! /^Current configuration:.*$$/, ''
16
- cfg.gsub! /^! Configuration saved on .*$/, ''
16
+ cfg.gsub! /^! Configuration (saved|generated) on .*$/, ''
17
17
  cfg
18
18
  end
19
19
 
@@ -15,8 +15,9 @@ class FortiOS < Oxidized::Model
15
15
  end
16
16
 
17
17
  cmd :secret do |cfg|
18
- cfg.gsub! /(set (?:passwd|password|psksecret|secret|key ENC)).*/, '\\1 <configuration removed>'
18
+ cfg.gsub! /(set (?:passwd|password|secondary-secret|rsso-secret|psksecret|secret|key ENC)).*/, '\\1 <configuration removed>'
19
19
  cfg.gsub! /(set private-key).*-+END ENCRYPTED PRIVATE KEY-*"$/m , '\\1 <configuration removed>'
20
+ cfg.gsub! /(IPS Malicious URL Database).*/, '\\1 <configuration removed>'
20
21
  cfg
21
22
  end
22
23
 
@@ -38,6 +39,7 @@ class FortiOS < Oxidized::Model
38
39
  #do not include if variable "show_autoupdate" is set to false
39
40
  if defined?(vars(:fortios_autoupdate)).nil? || vars(:fortios_autoupdate)
40
41
  cfg << cmd('diagnose autoupdate version') do |cfg|
42
+ cfg.gsub! /(FDS Address\n---------\n).*/, '\\1IP Address removed'
41
43
  comment cfg.each_line.reject { |line| line.match /Last Update|Result/ }.join
42
44
  end
43
45
  end
@@ -15,6 +15,8 @@ class FTOS < Oxidized::Model
15
15
  end
16
16
 
17
17
  cmd 'show inventory' do |cfg|
18
+ # Old versions of FTOS can occasionally return data that triggers encoding errors.
19
+ cfg.encode!("UTF-8", :invalid => :replace, :undef => :replace, :replace => "")
18
20
  comment cfg
19
21
  end
20
22
 
@@ -0,0 +1,41 @@
1
+ class Hirschmann < Oxidized::Model
2
+
3
+ prompt /^[\(\w\s\w\)]+\s[>|#]+?$/
4
+
5
+ comment '## '
6
+
7
+ #Handle pager
8
+ expect /^--More--.*$/ do |data, re|
9
+ send 'a'
10
+ data.sub re, ''
11
+ end
12
+
13
+ cmd :all do |cfg|
14
+ cfg.each_line.to_a[1..-2].join
15
+ end
16
+
17
+ cmd 'show sysinfo' do |cfg|
18
+ cfg.gsub! /^System Up Time.*\n/, ""
19
+ cfg.gsub! /^System Date and Time.*\n/, ""
20
+ cfg.gsub! /^CPU Utilization.*\n/, ""
21
+ cfg.gsub! /^Memory.*\n/, ""
22
+ cfg.gsub! /^Average CPU Utilization.*\n/, ""
23
+ comment cfg
24
+ end
25
+
26
+ cmd 'show running-config' do |cfg|
27
+ cfg.gsub! /^users.*\n/, ""
28
+ cfg
29
+ end
30
+
31
+ cfg :telnet do
32
+ username /^User:/
33
+ password /^Password:/
34
+ end
35
+
36
+ cfg :telnet, :ssh do
37
+ post_login 'enable'
38
+ pre_logout 'logout'
39
+ end
40
+
41
+ end
@@ -0,0 +1,13 @@
1
+ class HpeMsa < Oxidized::Model
2
+
3
+ prompt /^#\s?$/
4
+
5
+ cmd 'show configuration'
6
+
7
+ cfg :ssh do
8
+ post_login 'set cli-parameters pager disabled'
9
+ pre_logout 'exit'
10
+ end
11
+
12
+ end
13
+
@@ -126,8 +126,8 @@ class IOS < Oxidized::Model
126
126
  end
127
127
 
128
128
  cfg :telnet do
129
- username /^Username:/
130
- password /^Password:/
129
+ username /^Username:/i
130
+ password /^Password:/i
131
131
  end
132
132
 
133
133
  cfg :telnet, :ssh do
@@ -36,6 +36,7 @@ class IOSXR < Oxidized::Model
36
36
  cfg :telnet, :ssh do
37
37
  post_login 'terminal length 0'
38
38
  post_login 'terminal width 0'
39
+ post_login 'terminal exec prompt no-timestamp'
39
40
  if vars :enable
40
41
  post_login do
41
42
  send "enable\n"
@@ -3,7 +3,7 @@ class IPOS < Oxidized::Model
3
3
  # Ericsson SSR (IPOS)
4
4
  # Redback SE (SEOS)
5
5
 
6
- prompt /^([\[\]\w.@-]+[#>]\s?)$/
6
+ prompt /^([\[\]\w.@-]+[#:>]\s?)$/
7
7
  comment '! '
8
8
 
9
9
  cmd 'show chassis' do |cfg|
@@ -52,6 +52,12 @@ class IPOS < Oxidized::Model
52
52
 
53
53
  cfg :telnet, :ssh do
54
54
  post_login 'terminal length 0'
55
+ if vars :enable
56
+ post_login do
57
+ cmd "enable"
58
+ cmd vars(:enable)
59
+ end
60
+ end
55
61
  pre_logout do
56
62
  send "exit\n"
57
63
  send "n\n"
@@ -34,6 +34,8 @@ class IronWare < Oxidized::Model
34
34
  cfg.gsub! /(^((.*)Current temp(.*))$)/, '' #remove unwanted lines current temperature
35
35
  cfg.gsub! /Speed = [A-Z-]{2,6} \(\d{2,3}\%\)/, '' #remove unwanted lines Speed Fans
36
36
  cfg.gsub! /current speed is [A-Z]{2,6} \(\d{2,3}\%\)/, ''
37
+ cfg.gsub! /Fan \d* - STATUS: OK \D*\d*./, '' # Fix for ADX Fan speed reporting
38
+ cfg.gsub! /\d* deg C/, '' # Fix for ADX temperature reporting
37
39
  cfg.gsub! /([\[]*)1([\]]*)<->([\[]*)2([\]]*)(<->([\[]*)3([\]]*))*/, ''
38
40
  cfg.gsub! /\d{2}\.\d deg-C/, 'XX.X deg-C'
39
41
  if cfg.include? "TEMPERATURE"
@@ -50,6 +52,7 @@ class IronWare < Oxidized::Model
50
52
  end
51
53
 
52
54
  cmd 'show flash' do |cfg|
55
+ cfg.gsub! /(\d+) bytes/, '' # Fix for ADX flash size
53
56
  comment cfg
54
57
  end
55
58
 
@@ -67,7 +70,7 @@ class IronWare < Oxidized::Model
67
70
  # match expected prompts on both older and newer
68
71
  # versions of IronWare
69
72
  username /^(Please Enter Login Name|Username):/
70
- password /^(Please Enter Password |Password):/
73
+ password /^(Please Enter Password ?|Password):/
71
74
  end
72
75
 
73
76
  #handle pager with enable
@@ -8,21 +8,29 @@ class Netgear < Oxidized::Model
8
8
  cfg
9
9
  end
10
10
 
11
+ cfg :telnet do
12
+ username /^User:/
13
+ end
14
+
11
15
  cfg :telnet, :ssh do
12
16
  if vars :enable
13
17
  post_login do
14
- cmd 'enable'
18
+ send "enable\n"
15
19
  # Interpret enable: true as meaning we won't be prompted for a password
16
20
  unless vars(:enable).is_a? TrueClass
17
21
  expect /[pP]assword:\s?$/
18
- cmd vars(:enable) + "\n"
22
+ send vars(:enable) + "\n"
19
23
  end
20
24
  expect /^.+[#]$/
21
25
  end
22
26
  end
23
27
  post_login 'terminal length 0'
24
- pre_logout 'exit'
25
- pre_logout 'quit'
28
+ # quit / logout will sometimes prompt the user:
29
+ #
30
+ # The system has unsaved changes.
31
+ # Would you like to save them now? (y/n)
32
+ #
33
+ # So it is safer simply to disconnect and not issue a pre_logout command
26
34
  end
27
35
 
28
36
  cmd 'show running-config' do |cfg|
@@ -28,6 +28,6 @@ class PanOS < Oxidized::Model
28
28
 
29
29
  cfg :ssh do
30
30
  post_login 'set cli pager off'
31
- pre_logout 'exit'
31
+ pre_logout 'quit'
32
32
  end
33
33
  end
@@ -39,9 +39,10 @@ class Planet < Oxidized::Model
39
39
 
40
40
  cfg = cfg.each_line.to_a[0...-2]
41
41
 
42
- # Strip system time and system uptime from planet gs switches
42
+ # Strip system (up)time and temperature
43
43
  cfg = cfg.reject { |line| line.match /System Time\s*:.*/ }
44
44
  cfg = cfg.reject { |line| line.match /System Uptime\s*:.*/ }
45
+ cfg = cfg.reject { |line| line.match /Temperature\s*:.*/ }
45
46
 
46
47
  comment cfg.join
47
48
  end
@@ -13,6 +13,11 @@ class PowerConnect < Oxidized::Model
13
13
  cfg.each_line.to_a[1..-3].join
14
14
  end
15
15
 
16
+ cmd :secret do |cfg|
17
+ cfg.gsub! /^username (\S+) password \S+ (.*)/, 'username \1 password <hidden> \2'
18
+ cfg
19
+ end
20
+
16
21
  cmd 'show version' do |cfg|
17
22
  if (@stackable.nil?)
18
23
  @stackable = true if cfg.match /(U|u)nit\s/
@@ -30,6 +30,7 @@ class Procurve < Oxidized::Model
30
30
  cfg.gsub! /^(snmp-server community).*/, '\\1 <configuration removed>'
31
31
  cfg.gsub! /^(snmp-server host).*/, '\\1 <configuration removed>'
32
32
  cfg.gsub! /^(radius-server host).*/, '\\1 <configuration removed>'
33
+ cfg.gsub! /^(radius-server key).*/, '\\1 <configuration removed>'
33
34
  cfg
34
35
  end
35
36
 
@@ -37,6 +38,18 @@ class Procurve < Oxidized::Model
37
38
  comment cfg
38
39
  end
39
40
 
41
+ cmd 'show modules' do |cfg|
42
+ comment cfg
43
+ end
44
+
45
+ cmd 'show interfaces transceiver' do |cfg|
46
+ comment cfg
47
+ end
48
+
49
+ cmd 'show flash' do |cfg|
50
+ comment cfg
51
+ end
52
+
40
53
  # not supported on all models
41
54
  cmd 'show system-information' do |cfg|
42
55
  cfg = cfg.split("\n")[0..-8].join("\n")
@@ -10,11 +10,18 @@ class RouterOS < Oxidized::Model
10
10
  comment cfg
11
11
  end
12
12
 
13
- cmd '/export' do |cfg|
14
- cfg.gsub! /\x1B\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m|K]/, '' # strip ANSI colours
15
- cfg.gsub! /\\\r\n\s+/, '' # strip new line
16
- cfg = cfg.split("\n").select { |line| not line[/^\#\s\w{3}\/\d{2}\/\d{4}.*$/] }
17
- cfg.join("\n") + "\n"
13
+ cmd '/system history print' do |cfg|
14
+ comment cfg
15
+ end
16
+
17
+ post do
18
+ run_cmd = vars(:remove_secret) ? '/export hide-sensitive' : '/export'
19
+ cmd run_cmd do |cfg|
20
+ cfg.gsub! /\x1B\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m|K]/, '' # strip ANSI colours
21
+ cfg.gsub! /\\\r\n\s+/, '' # strip new line
22
+ cfg = cfg.split("\n").select { |line| not line[/^\#\s\w{3}\/\d{2}\/\d{4}.*$/] }
23
+ cfg.join("\n") + "\n"
24
+ end
18
25
  end
19
26
 
20
27
  cfg :telnet do
@@ -0,0 +1,46 @@
1
+ class SGOS < Oxidized::Model
2
+
3
+ comment '!- '
4
+ prompt /\w+>|#/
5
+
6
+ expect /--More--/ do |data, re|
7
+ send ' '
8
+ data.sub re, ''
9
+ end
10
+
11
+ cmd :all do |cfg|
12
+ cfg.each_line.to_a[1..-3].join
13
+ end
14
+
15
+ cmd 'show licenses' do |cfg|
16
+ comment cfg
17
+ end
18
+
19
+ cmd 'show general' do |cfg|
20
+ comment cfg
21
+ end
22
+
23
+ cmd :secret do |cfg|
24
+ cfg.gsub! /^(security hashed-enable-password).*/, '\\1 <secret hidden>'
25
+ cfg.gsub! /^(security hashed-password).*/, '\\1 <secret hidden>'
26
+ cfg
27
+ end
28
+
29
+ cmd 'show configuration expanded noprompts with-keyrings unencrypted' do |cfg|
30
+ cfg.gsub! /^(!- Local time).*/,""
31
+ cfg.gsub! /^(archive-configuration encrypted-password).*/, ""
32
+ cfg.gsub! /^(download encrypted-password).*/, ""
33
+ cfg
34
+ end
35
+
36
+ cfg :telnet, :ssh do
37
+ # preferred way to handle additional passwords
38
+ if vars :enable
39
+ post_login do
40
+ send "enable\n"
41
+ cmd vars(:enable)
42
+ end
43
+ end
44
+ pre_logout 'exit'
45
+ end
46
+ end