oxidized 0.30.1 → 0.31.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +2 -2
- data/.github/workflows/stale.yml +4 -2
- data/.rubocop.yml +18 -2
- data/.rubocop_todo.yml +5 -12
- data/CHANGELOG.md +61 -1
- data/CONTRIBUTING.md +5 -0
- data/Dockerfile +82 -21
- data/README.md +5 -21
- data/Rakefile +3 -2
- data/docs/Configuration.md +36 -12
- data/docs/Creating-Models.md +45 -4
- data/docs/Hooks.md +34 -0
- data/docs/Issues.md +91 -0
- data/docs/Model-Notes/Cumulus.md +5 -0
- data/docs/Model-Notes/FSOS.md +5 -0
- data/docs/Model-Notes/FortiOS.md +21 -5
- data/docs/Model-Notes/HPEAruba.md +31 -0
- data/docs/Model-Notes/OS6.md +10 -0
- data/docs/Model-Notes/RouterOS.md +15 -0
- data/docs/Model-Notes/SikluMHTG.md +7 -0
- data/docs/Outputs.md +2 -0
- data/docs/Release.md +18 -15
- data/docs/Sources.md +21 -0
- data/docs/Supported-OS-Types.md +11 -5
- data/docs/Troubleshooting.md +35 -0
- data/examples/device-simulation/README.md +173 -0
- data/examples/device-simulation/cmdsets/aoscx +9 -0
- data/examples/device-simulation/cmdsets/arubainstant +5 -0
- data/examples/device-simulation/cmdsets/asa +7 -0
- data/examples/device-simulation/cmdsets/ios +7 -0
- data/examples/device-simulation/cmdsets/nxos +5 -0
- data/examples/device-simulation/cmdsets/routeros +5 -0
- data/examples/device-simulation/cmdsets/srosmd +11 -0
- data/examples/device-simulation/device2yaml.rb +225 -0
- data/examples/device-simulation/yaml/aoscx_R0X25A-6410_FL.10.10.1100.yaml +2281 -0
- data/examples/device-simulation/yaml/aoscx_R8N85A-C6000-48G-CL4_PL.10.08.1010.yaml +451 -0
- data/examples/device-simulation/yaml/arubainstant_IAP515_8.10.0.6_VWLC.yaml +213 -0
- data/examples/device-simulation/yaml/asa_5512_9.12-4-67_single-context.yaml +531 -0
- data/examples/device-simulation/yaml/asr920_16.8.1b.yaml +1122 -0
- data/examples/device-simulation/yaml/garderos_R7709_003_006_068.yaml +101 -0
- data/examples/device-simulation/yaml/iosxe_C9200L-24P-4G_17.09.04a.yaml +514 -0
- data/examples/device-simulation/yaml/iosxe_C9800-L-F-K9_17.06.05.yaml +417 -0
- data/examples/device-simulation/yaml/riverbed_915.yaml +123 -0
- data/examples/device-simulation/yaml/routeros_CHR_7.10.1.yaml +145 -0
- data/examples/device-simulation/yaml/routeros_CHR_7.16.yaml +79 -0
- data/examples/device-simulation/yaml/routeros_L009UiGS_7.15.2.yaml +353 -0
- data/examples/podman-compose/Makefile +60 -17
- data/examples/podman-compose/README.md +63 -27
- data/examples/podman-compose/docker-compose.yml +11 -2
- data/examples/podman-compose/gitserver/.gitignore +1 -0
- data/examples/podman-compose/gitserver/Dockerfile +14 -0
- data/examples/podman-compose/model-simulation/Dockerfile-model +1 -1
- data/examples/podman-compose/model-simulation/asternos.sh +2 -0
- data/examples/podman-compose/oxidized-config/.gitignore +2 -0
- data/examples/podman-compose/oxidized-config/config +1 -1
- data/examples/podman-compose/oxidized-config/config_csv-file +46 -0
- data/examples/podman-compose/oxidized-config/config_csv-gitserver +56 -0
- data/examples/podman-compose/oxidized-ssh/.gitignore +1 -0
- data/lib/oxidized/config.rb +7 -1
- data/lib/oxidized/hook/githubrepo.rb +37 -7
- data/lib/oxidized/hook/slackdiff.rb +29 -7
- data/lib/oxidized/input/http.rb +1 -0
- data/lib/oxidized/input/telnet.rb +1 -1
- data/lib/oxidized/manager.rb +17 -16
- data/lib/oxidized/model/aoscx.rb +16 -2
- data/lib/oxidized/model/aosw.rb +7 -1
- data/lib/oxidized/model/arubainstant.rb +90 -0
- data/lib/oxidized/model/audiocodes.rb +2 -2
- data/lib/oxidized/model/cnos.rb +13 -10
- data/lib/oxidized/model/cumulus.rb +3 -0
- data/lib/oxidized/model/dlink.rb +1 -0
- data/lib/oxidized/model/dlinknextgen.rb +3 -0
- data/lib/oxidized/model/edgecos.rb +2 -1
- data/lib/oxidized/model/eos.rb +2 -0
- data/lib/oxidized/model/f5os.rb +17 -0
- data/lib/oxidized/model/firewareos.rb +10 -1
- data/lib/oxidized/model/fortios.rb +24 -1
- data/lib/oxidized/model/garderos.rb +43 -0
- data/lib/oxidized/model/h3c.rb +1 -1
- data/lib/oxidized/model/ibos.rb +1 -0
- data/lib/oxidized/model/ios.rb +20 -12
- data/lib/oxidized/model/iosxr.rb +1 -1
- data/lib/oxidized/model/lenovonos.rb +2 -0
- data/lib/oxidized/model/linuxgeneric.rb +1 -1
- data/lib/oxidized/model/netgear.rb +1 -1
- data/lib/oxidized/model/nodegrid.rb +1 -1
- data/lib/oxidized/model/nsxdfw.rb +30 -0
- data/lib/oxidized/model/nxos.rb +2 -1
- data/lib/oxidized/model/os6.rb +48 -0
- data/lib/oxidized/model/rgos.rb +1 -1
- data/lib/oxidized/model/riverbed.rb +104 -0
- data/lib/oxidized/model/routeros.rb +2 -2
- data/lib/oxidized/model/saos.rb +18 -1
- data/lib/oxidized/model/siklumhtg.rb +22 -0
- data/lib/oxidized/model/uplinkolt.rb +46 -0
- data/lib/oxidized/model/vyatta.rb +2 -2
- data/lib/oxidized/model/xos.rb +7 -0
- data/lib/oxidized/node.rb +30 -18
- data/lib/oxidized/nodes.rb +13 -5
- data/lib/oxidized/output/file.rb +45 -42
- data/lib/oxidized/output/git.rb +185 -160
- data/lib/oxidized/output/gitcrypt.rb +188 -186
- data/lib/oxidized/output/http.rb +53 -51
- data/lib/oxidized/output/output.rb +6 -4
- data/lib/oxidized/source/csv.rb +44 -49
- data/lib/oxidized/source/http.rb +63 -81
- data/lib/oxidized/source/jsonfile.rb +63 -0
- data/lib/oxidized/source/source.rb +43 -18
- data/lib/oxidized/source/sql.rb +66 -59
- data/lib/oxidized/version.rb +2 -2
- data/oxidized.gemspec +22 -16
- metadata +111 -15
@@ -31,7 +31,8 @@ class EdgeCOS < Oxidized::Model
|
|
31
31
|
|
32
32
|
cmd 'show system' do |cfg|
|
33
33
|
cfg.gsub! /^.*\sUp Time\s*:.*\n/i, ''
|
34
|
-
cfg.gsub!
|
34
|
+
cfg.gsub! /(\sTemperature \d*:)\s*\d+ degrees/, '\\1 <temperature values hidden>'
|
35
|
+
cfg.gsub! /^!?\s*Fan \d+ speed:\s+\d+ rpm\s+Fan \d+ speed:\s+\d+ rpm\s+Fan \d+ speed:\s+\d+ rpm$/, '<fan speeds hidden>'
|
35
36
|
comment cfg
|
36
37
|
end
|
37
38
|
|
data/lib/oxidized/model/eos.rb
CHANGED
@@ -18,7 +18,9 @@ class EOS < Oxidized::Model
|
|
18
18
|
cfg.gsub! /^(enable (?:secret|password)).*/, '\\1 <configuration removed>'
|
19
19
|
cfg.gsub! /^(service unsupported-transceiver).*/, '\\1 <license key removed>'
|
20
20
|
cfg.gsub! /^(tacacs-server key \d+).*/, '\\1 <configuration removed>'
|
21
|
+
cfg.gsub! /^(radius-server .+ key \d) \S+/, '\\1 <radius secret hidden>'
|
21
22
|
cfg.gsub! /( {6}key) (\h+ 7) (\h+).*/, '\\1 <secret hidden>'
|
23
|
+
cfg.gsub! /(localized|auth (md5|sha\d{0,3})|priv (des|aes\d{0,3})) \S+/, '\\1 <secret hidden>'
|
22
24
|
cfg
|
23
25
|
end
|
24
26
|
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class F5OS < Oxidized::Model
|
4
|
+
# F5OS Model #
|
5
|
+
|
6
|
+
comment '!'
|
7
|
+
prompt(/^([\w.@()-]+ ?[#>]\s+)$/)
|
8
|
+
|
9
|
+
cmd 'show running-config'
|
10
|
+
|
11
|
+
cfg :ssh do
|
12
|
+
post_login do
|
13
|
+
cmd 'paginate false'
|
14
|
+
end
|
15
|
+
pre_logout 'exit'
|
16
|
+
end
|
17
|
+
end
|
@@ -1,7 +1,16 @@
|
|
1
1
|
class FirewareOS < Oxidized::Model
|
2
2
|
using Refinements
|
3
3
|
|
4
|
-
|
4
|
+
# matched prompts:
|
5
|
+
# [FAULT]WG<managed-by-wsm><master>>
|
6
|
+
# WG<managed-by-wsm><master>>
|
7
|
+
# WG<managed-by-wsm>>
|
8
|
+
# [FAULT]WG<non-master>>
|
9
|
+
# [FAULT]WG>
|
10
|
+
# WG>
|
11
|
+
|
12
|
+
prompt /^\[?\w*\]?\w*?(?:<[\w-]+>)*(#|>)\s*$/
|
13
|
+
|
5
14
|
comment '-- '
|
6
15
|
|
7
16
|
cmd :all do |cfg|
|
@@ -22,6 +22,8 @@ class FortiOS < Oxidized::Model
|
|
22
22
|
end
|
23
23
|
|
24
24
|
cmd :secret do |cfg|
|
25
|
+
# Remove private key for encrypted configs
|
26
|
+
cfg.gsub! /^(\#private-encryption-key=).+/, '\\1 <configuration removed>'
|
25
27
|
# ENC indicates an encrypted password, and secret indicates a secret string
|
26
28
|
cfg.gsub! /(set .+ ENC) .+/, '\\1 <configuration removed>'
|
27
29
|
cfg.gsub! /(set .*secret) .+/, '\\1 <configuration removed>'
|
@@ -73,10 +75,31 @@ class FortiOS < Oxidized::Model
|
|
73
75
|
|
74
76
|
cfg << cmd('end') if @vdom_enabled
|
75
77
|
|
76
|
-
|
78
|
+
# Different OS have different commands - we use the first that works
|
79
|
+
# - For fortigate > 7 and possibly earlier versions, we use:
|
80
|
+
# show | grep . # backup as in fortigate GUI
|
81
|
+
# show full-configuration | grep . # bakup including default values
|
82
|
+
# | grep is used to avoid the --More-- prompt
|
83
|
+
# - It is not documented which systems need the commands without | grep:
|
84
|
+
# show full-configuration
|
85
|
+
# show
|
86
|
+
# Document it here and make a PR on github if you know!
|
87
|
+
# By default, we use the configuration without default values
|
88
|
+
# If fullconfig: true is set in the configuration, we get the full config
|
89
|
+
commandlist = if vars(:fullconfig)
|
90
|
+
['show full-configuration | grep .',
|
91
|
+
'show full-configuration', 'show']
|
92
|
+
else
|
93
|
+
['show | grep .',
|
94
|
+
'show full-configuration', 'show']
|
95
|
+
end
|
96
|
+
|
97
|
+
commandlist.each do |fullcmd|
|
77
98
|
fullcfg = cmd(fullcmd)
|
78
99
|
next if fullcfg.lines[1..3].join =~ /(Parsing error at|command parse error)/ # Don't show for unsupported devices (e.g. FortiAnalyzer, FortiManager, FortiMail)
|
79
100
|
|
101
|
+
fullcfg.gsub! /(set comments "Error \(No order (found )?for (account )?ID \d+\) on).*/, '\\1 <stripped>"'
|
102
|
+
|
80
103
|
cfg << fullcfg
|
81
104
|
break
|
82
105
|
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
class Garderos < Oxidized::Model
|
2
|
+
using Refinements
|
3
|
+
# Garderos GmbH https://www.garderos.com/
|
4
|
+
# Routers for harsh environments
|
5
|
+
# grs = Garderos Router Software
|
6
|
+
|
7
|
+
# remove all ANSI escape codes, as GRS uses them :-(
|
8
|
+
# the prompt does not need to match escape codes, as they have been removed
|
9
|
+
expect /\e\[\d*m\r?/ do |data, re|
|
10
|
+
data.gsub re, ''
|
11
|
+
end
|
12
|
+
|
13
|
+
prompt /[\w-]+# /
|
14
|
+
comment '# '
|
15
|
+
|
16
|
+
cmd :all do |cfg|
|
17
|
+
# Remove the echo of the entered command and the prompt after it
|
18
|
+
cfg.cut_both
|
19
|
+
end
|
20
|
+
|
21
|
+
cmd 'show system version' do |cfg|
|
22
|
+
comment "#{cfg}\n"
|
23
|
+
end
|
24
|
+
|
25
|
+
cmd 'show system serial' do |cfg|
|
26
|
+
comment "#{cfg}\n"
|
27
|
+
end
|
28
|
+
|
29
|
+
# If we have a radio modem installed, we'd like to list the SIM Card
|
30
|
+
cmd 'show hardware wwan wwan0 sim' do |cfg|
|
31
|
+
if cfg.start_with? 'Unknown command'
|
32
|
+
''
|
33
|
+
else
|
34
|
+
comment "#{cfg}\n"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
cmd 'show configuration running'
|
39
|
+
|
40
|
+
cfg :ssh do
|
41
|
+
pre_logout 'exit'
|
42
|
+
end
|
43
|
+
end
|
data/lib/oxidized/model/h3c.rb
CHANGED
data/lib/oxidized/model/ibos.rb
CHANGED
data/lib/oxidized/model/ios.rb
CHANGED
@@ -27,23 +27,29 @@ class IOS < Oxidized::Model
|
|
27
27
|
|
28
28
|
cmd :secret do |cfg|
|
29
29
|
cfg.gsub! /^(snmp-server community).*/, '\\1 <configuration removed>'
|
30
|
-
cfg.gsub! /^(snmp-server host \S+( vrf \S+)?( informs?)?( version (1|2c
|
30
|
+
cfg.gsub! /^(snmp-server host \S+( vrf \S+)?( informs?)?( version (1|2c))?) +\S+( .*)?$*/, '\\1 <secret hidden>\\6'
|
31
31
|
cfg.gsub! /^(username .+ (password|secret) \d) .+/, '\\1 <secret hidden>'
|
32
32
|
cfg.gsub! /^(enable (password|secret)( level \d+)? \d) .+/, '\\1 <secret hidden>'
|
33
|
-
cfg.gsub! /^(
|
33
|
+
cfg.gsub! /^( +(?:password|secret)) (?:\d )?\S+/, '\\1 <secret hidden>'
|
34
34
|
cfg.gsub! /^(.*wpa-psk ascii \d) (\S+)/, '\\1 <secret hidden>'
|
35
35
|
cfg.gsub! /^(.*key 7) (\d.+)/, '\\1 <secret hidden>'
|
36
36
|
cfg.gsub! /^(tacacs-server (.+ )?key) .+/, '\\1 <secret hidden>'
|
37
37
|
cfg.gsub! /^(crypto isakmp key) (\S+) (.*)/, '\\1 <secret hidden> \\3'
|
38
|
-
cfg.gsub! /^(
|
39
|
-
cfg.gsub! /^(
|
40
|
-
cfg.gsub! /^(
|
41
|
-
cfg.gsub! /^(
|
42
|
-
cfg.gsub! /^(
|
43
|
-
cfg.gsub! /^(
|
44
|
-
cfg.gsub! /^(
|
45
|
-
cfg.gsub! /^((tacacs|radius) server [^\n]+\n(
|
46
|
-
cfg.gsub! /^(
|
38
|
+
cfg.gsub! /^( +ip ospf message-digest-key \d+ md5) .+/, '\\1 <secret hidden>'
|
39
|
+
cfg.gsub! /^( +ip ospf authentication-key) .+/, '\\1 <secret hidden>'
|
40
|
+
cfg.gsub! /^( +neighbor \S+ password) .+/, '\\1 <secret hidden>'
|
41
|
+
cfg.gsub! /^( +vrrp \d+ authentication text) .+/, '\\1 <secret hidden>'
|
42
|
+
cfg.gsub! /^( +standby \d+ authentication) .{1,8}$/, '\\1 <secret hidden>'
|
43
|
+
cfg.gsub! /^( +standby \d+ authentication md5 key-string) .+?( timeout \d+)?$/, '\\1 <secret hidden> \\2'
|
44
|
+
cfg.gsub! /^( +key-string) .+/, '\\1 <secret hidden>'
|
45
|
+
cfg.gsub! /^((tacacs|radius) server [^\n]+\n( +[^\n]+\n)* +key) [^\n]+$/m, '\1 <secret hidden>'
|
46
|
+
cfg.gsub! /^( +ppp (chap|pap) password \d) .+/, '\\1 <secret hidden>'
|
47
|
+
cfg.gsub! /^( +security wpa psk set-key (?:ascii|hex) \d) (.*)$/, '\\1 <secret hidden>'
|
48
|
+
cfg.gsub! /^( +dot1x username \S+ password \d) (.*)$/, '\\1 <secret hidden>'
|
49
|
+
cfg.gsub! /^( +mgmtuser username \S+ password \d) (.*) (secret \d) (.*)$/, '\\1 <secret hidden> \\3 <secret hidden>'
|
50
|
+
cfg.gsub! /^( +client \S+ server-key \d) (.*)$/, '\\1 <secret hidden>'
|
51
|
+
cfg.gsub! /^( +domain-password) \S+ ?(.*)/, '\\1 <secret hidden> \\2'
|
52
|
+
cfg.gsub! /^( +pre-shared-key).*/, '\\1 <configuration removed>'
|
47
53
|
cfg
|
48
54
|
end
|
49
55
|
|
@@ -74,7 +80,7 @@ class IOS < Oxidized::Model
|
|
74
80
|
|
75
81
|
comments << "Memory: pcmcia #{Regexp.last_match(2)} #{Regexp.last_match(3)}#{Regexp.last_match(4)} #{Regexp.last_match(1)}" if line =~ /^(\d+[kK]) bytes of (Flash|ATA)?.*PCMCIA .*(slot|disk) ?(\d)/i
|
76
82
|
|
77
|
-
if line =~ /(\S+(?:\sseries)?)\s+(?:\((\S+)\)\s+processor|\(revision[^)]+\)).*\s+with (\S+k) bytes/i
|
83
|
+
if line =~ /(\S+(?:\sseries)?)\s+(?:\(([\S ]+)\)\s+processor|\(revision[^)]+\)).*\s+with (\S+k) bytes/i
|
78
84
|
sproc = Regexp.last_match(1)
|
79
85
|
cpu = Regexp.last_match(2)
|
80
86
|
mem = Regexp.last_match(3)
|
@@ -118,6 +124,8 @@ class IOS < Oxidized::Model
|
|
118
124
|
cfg.gsub! /^ tunnel mpls traffic-eng bandwidth[^\n]*\n*(
|
119
125
|
(?: [^\n]*\n*)*
|
120
126
|
tunnel mpls traffic-eng auto-bw)/mx, '\1'
|
127
|
+
# get rid of values of custom SNMP OID's
|
128
|
+
cfg.gsub! /^(\s+expression) \d+$/, '\\1 <value removed>'
|
121
129
|
cfg
|
122
130
|
end
|
123
131
|
end
|
data/lib/oxidized/model/iosxr.rb
CHANGED
@@ -42,6 +42,7 @@ class LenovoNOS < Oxidized::Model
|
|
42
42
|
cfg = cfg.reject { |line| line.match /^Last boot:/ }
|
43
43
|
cfg = cfg.reject { |line| line.match /^Temperature / }
|
44
44
|
cfg = cfg.reject { |line| line.match /^Power Consumption/ }
|
45
|
+
cfg = cfg.reject { |line| line.match /^Fan/ }
|
45
46
|
|
46
47
|
cfg = cfg.join
|
47
48
|
comment_ext("=== show version ===", cfg)
|
@@ -63,6 +64,7 @@ class LenovoNOS < Oxidized::Model
|
|
63
64
|
cfg.gsub! /^Current configuration:[^\n]*\n/, ''
|
64
65
|
if vars(:remove_unstable_lines) == true
|
65
66
|
cfg.gsub! /(.* password )"[0-9a-f]+"(.*)/, '\\1<unstable line hidden>\\2'
|
67
|
+
cfg.gsub! /(.* administrator-password )"[0-9a-f]+"(.*)/, '\\1<unstable line hidden>\\2'
|
66
68
|
cfg.gsub! /(.*ekey )"[0-9a-f]+"(.*)/, '\\1<unstable line hidden>\\2'
|
67
69
|
end
|
68
70
|
cfg
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
class NSXDfw < Oxidized::Model
|
3
|
+
using Refinements
|
4
|
+
|
5
|
+
cmd "/policy/api/v1/infra/domains/" do |cfg|
|
6
|
+
domains = JSON.parse(cfg.encode('UTF-8', { invalid: :replace, undef: :replace, replace: '?' }))["results"]
|
7
|
+
domain_config = {}
|
8
|
+
domains.each do |domain|
|
9
|
+
domain_config[domain['id']] = {}
|
10
|
+
policies_data = cmd "/policy/api/v1/infra/domains/#{domain['id']}/security-policies/"
|
11
|
+
policies = JSON.parse(policies_data.encode('UTF-8', { invalid: :replace, undef: :replace, replace: '?' }))["results"]
|
12
|
+
policies_config = {}
|
13
|
+
policies.each do |policy|
|
14
|
+
rules_data = cmd "/policy/api/v1/infra/domains/#{domain['id']}/security-policies/#{policy['id']}/rules"
|
15
|
+
rules = JSON.parse(rules_data.encode('UTF-8', { invalid: :replace, undef: :replace, replace: '?' }))["results"]
|
16
|
+
policies_config[policy['id']] = rules
|
17
|
+
end
|
18
|
+
domain_config[domain['id']] = policies_config
|
19
|
+
end
|
20
|
+
JSON.pretty_generate(domain_config)
|
21
|
+
end
|
22
|
+
|
23
|
+
cfg :http do
|
24
|
+
@username = @node.auth[:username]
|
25
|
+
@password = @node.auth[:password]
|
26
|
+
@headers['Content-Type'] = 'application/json'
|
27
|
+
@headers['Accept'] = 'application/json'
|
28
|
+
@secure = true
|
29
|
+
end
|
30
|
+
end
|
data/lib/oxidized/model/nxos.rb
CHANGED
@@ -13,8 +13,9 @@ class NXOS < Oxidized::Model
|
|
13
13
|
cfg.gsub! /^(snmp-server community).*/, '\\1 <secret hidden>'
|
14
14
|
cfg.gsub! /^(snmp-server user (\S+) (\S+) auth (\S+)) (\S+) (priv) (\S+)/, '\\1 <secret hidden> '
|
15
15
|
cfg.gsub! /^(snmp-server host.*? )\S+( udp-port \d+)?$/, '\\1<secret hidden>\\2'
|
16
|
+
cfg.gsub! /^(snmp-server mib community-map) \S+ ?(.*)/, '\\1 <secret hidden> \\2'
|
16
17
|
cfg.gsub! /(password \d+) (\S+)/, '\\1 <secret hidden>'
|
17
|
-
cfg.gsub! /^(radius-server key)
|
18
|
+
cfg.gsub! /^(radius-server .*key(?: \d+)?) \S+/, '\\1 <secret hidden>'
|
18
19
|
cfg.gsub! /^(tacacs-server .*key(?: \d+)?) \S+/, '\\1 <secret hidden>'
|
19
20
|
cfg
|
20
21
|
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
class OS6 < Oxidized::Model
|
2
|
+
using Refinements
|
3
|
+
|
4
|
+
# For switches running Dell EMC Networking OS6 #
|
5
|
+
#
|
6
|
+
# Tested with : Dell PowerSwitch N2048
|
7
|
+
|
8
|
+
comment '! '
|
9
|
+
|
10
|
+
cmd :all do |cfg|
|
11
|
+
cfg.gsub! /^% Invalid input detected at '\^' marker\.$|^\s+\^$/, ''
|
12
|
+
cfg.each_line.to_a[2..-2].join
|
13
|
+
end
|
14
|
+
|
15
|
+
cmd :secret do |cfg|
|
16
|
+
cfg.gsub! /(password )(\S+)/, '\1<secret hidden>'
|
17
|
+
cfg
|
18
|
+
end
|
19
|
+
|
20
|
+
cmd 'show version' do |cfg|
|
21
|
+
comment cfg
|
22
|
+
end
|
23
|
+
|
24
|
+
cmd 'show interfaces transceiver properties' do |cfg|
|
25
|
+
comment cfg
|
26
|
+
end
|
27
|
+
|
28
|
+
cmd 'show running-config' do |cfg|
|
29
|
+
cfg.each_line.to_a[3..-1].join
|
30
|
+
end
|
31
|
+
|
32
|
+
cfg :telnet do
|
33
|
+
username /^Login:/
|
34
|
+
password /^Password:/
|
35
|
+
end
|
36
|
+
|
37
|
+
cfg :telnet, :ssh do
|
38
|
+
if vars :enable
|
39
|
+
post_login do
|
40
|
+
send "enable\n"
|
41
|
+
cmd vars(:enable)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
post_login 'terminal length 0'
|
45
|
+
pre_logout 'exit'
|
46
|
+
pre_logout 'exit'
|
47
|
+
end
|
48
|
+
end
|
data/lib/oxidized/model/rgos.rb
CHANGED
@@ -12,7 +12,7 @@ class RGOS < Oxidized::Model
|
|
12
12
|
|
13
13
|
cmd 'show version' do |cfg|
|
14
14
|
cfg = cfg.each_line.reject { |line| line.match /^System start time/ }.join
|
15
|
-
cfg = cfg.each_line.reject { |line| line.match
|
15
|
+
cfg = cfg.each_line.reject { |line| line.match /^\s*System uptime/ }.join
|
16
16
|
comment "#{cfg.cut_both}\n"
|
17
17
|
end
|
18
18
|
|
@@ -0,0 +1,104 @@
|
|
1
|
+
class Riverbed < Oxidized::Model
|
2
|
+
using Refinements
|
3
|
+
|
4
|
+
# Define the prompt
|
5
|
+
prompt /^.* *[\w-]+ *[#>] *$/
|
6
|
+
|
7
|
+
# Define comment character
|
8
|
+
comment '! '
|
9
|
+
|
10
|
+
# Remove sensitive information
|
11
|
+
cmd :secret do |cfg|
|
12
|
+
cfg.gsub! /^( *tacacs-server (.+ )?key) .+/, '\\1 <secret hidden>'
|
13
|
+
cfg.gsub! /^( *username .+ (password|secret) \d) .+/, '\\1 <secret hidden>'
|
14
|
+
cfg.gsub! /^( *ntp server .+ key) .+/, '\\1 <secret hidden>'
|
15
|
+
cfg.gsub! /^( *ntp peer .+ key) .+/, '\\1 <secret hidden>'
|
16
|
+
cfg.gsub! /^( *snmp-server community).*/, '\\1 <configuration removed>'
|
17
|
+
cfg.gsub! /^( *ip security shared secret).*/, '\\1 <secret hidden>'
|
18
|
+
cfg.gsub! /^( *service shared-secret secret client).*/, '\\1 <secret hidden>'
|
19
|
+
cfg.gsub! /^( *service shared-secret secret server).*/, '\\1 <secret hidden>'
|
20
|
+
cfg
|
21
|
+
end
|
22
|
+
|
23
|
+
# Get version information and output it as comments
|
24
|
+
cmd 'show version' do |cfg|
|
25
|
+
cfg = cfg.cut_both
|
26
|
+
|
27
|
+
output = ''
|
28
|
+
cfg.each_line do |line|
|
29
|
+
line.strip!
|
30
|
+
output << comment("Product name: #{Regexp.last_match(1)}\n") if line =~ /^Product name:\s+(.*)$/
|
31
|
+
output << comment("Product release: #{Regexp.last_match(1)}\n") if line =~ /^Product release:\s+(.*)$/
|
32
|
+
output << comment("Build ID: #{Regexp.last_match(1)}\n") if line =~ /^Build ID:\s+(.*)$/
|
33
|
+
output << comment("Build date: #{Regexp.last_match(1)}\n") if line =~ /^Build date:\s+(.*)$/
|
34
|
+
output << comment("Build arch: #{Regexp.last_match(1)}\n") if line =~ /^Build arch:\s+(.*)$/
|
35
|
+
output << comment("Built by: #{Regexp.last_match(1)}\n") if line =~ /^Built by:\s+(.*)$/
|
36
|
+
output << comment("Product model: #{Regexp.last_match(1)}\n") if line =~ /^Product model:\s+(.*)$/
|
37
|
+
output << comment("Number of CPUs: #{Regexp.last_match(1)}\n") if line =~ /^Number of CPUs:\s+(.*)$/
|
38
|
+
end
|
39
|
+
output + "\n"
|
40
|
+
end
|
41
|
+
|
42
|
+
# Get hardware information and output it as comments
|
43
|
+
cmd 'show hardware all' do |cfg|
|
44
|
+
cfg = cfg.cut_both
|
45
|
+
|
46
|
+
output = ''
|
47
|
+
cfg.each_line do |line|
|
48
|
+
line.strip!
|
49
|
+
output << comment("Hardware revision: #{Regexp.last_match(1)}\n") if line =~ /^Hardware revision:\s+(.*)$/
|
50
|
+
output << comment("Mainboard: #{Regexp.last_match(1)}\n") if line =~ /^Mainboard:\s+(.*)$/
|
51
|
+
if line =~ /^Slot (\d+):\s+\.*\s+(.*)$/
|
52
|
+
slot_number = Regexp.last_match(1)
|
53
|
+
slot_info = Regexp.last_match(2)
|
54
|
+
output << comment("Slot #{slot_number}: #{slot_info}\n")
|
55
|
+
end
|
56
|
+
output << comment("System led: #{Regexp.last_match(1)}\n") if line =~ /^System led:\s+(.*)$/
|
57
|
+
end
|
58
|
+
output + "\n"
|
59
|
+
end
|
60
|
+
|
61
|
+
# Get serial information and output it as comment
|
62
|
+
cmd 'show info' do |cfg|
|
63
|
+
cfg = cfg.cut_both
|
64
|
+
|
65
|
+
output = ''
|
66
|
+
cfg.each_line do |line|
|
67
|
+
line.strip!
|
68
|
+
output << comment("Serial: #{Regexp.last_match(1)}\n") if line =~ /^Serial:\s+(.*)$/
|
69
|
+
end
|
70
|
+
output + "\n"
|
71
|
+
end
|
72
|
+
|
73
|
+
# Get the running configuration
|
74
|
+
cmd 'show running-config' do |cfg|
|
75
|
+
cfg = cfg.cut_both
|
76
|
+
|
77
|
+
cfg = cfg.each_line.map do |line|
|
78
|
+
if line =~ /^(.*##.*?##)(.*)$/
|
79
|
+
comment_part = Regexp.last_match(1).strip
|
80
|
+
command_part = Regexp.last_match(2).strip
|
81
|
+
comment_line = comment(comment_part)
|
82
|
+
if command_part.empty?
|
83
|
+
comment_line + "\n"
|
84
|
+
else
|
85
|
+
comment_line + "\n" + command_part + "\n"
|
86
|
+
end
|
87
|
+
else
|
88
|
+
line
|
89
|
+
end
|
90
|
+
end.join
|
91
|
+
|
92
|
+
cfg
|
93
|
+
end
|
94
|
+
|
95
|
+
# SSH configuration
|
96
|
+
cfg :ssh do
|
97
|
+
post_login do
|
98
|
+
cmd 'enable'
|
99
|
+
cmd 'terminal length 0'
|
100
|
+
cmd 'terminal width 1024'
|
101
|
+
end
|
102
|
+
pre_logout 'exit'
|
103
|
+
end
|
104
|
+
end
|
@@ -14,8 +14,8 @@ class RouterOS < Oxidized::Model
|
|
14
14
|
cfg
|
15
15
|
end
|
16
16
|
|
17
|
-
cmd '/system
|
18
|
-
cfg = cfg.each_line.grep(/(
|
17
|
+
cmd '/system resource print' do |cfg|
|
18
|
+
cfg = cfg.each_line.grep(/(version|factory-software|total-memory|cpu|cpu-count|total-hdd-space|architecture-name|board-name|platform):/).join
|
19
19
|
comment cfg
|
20
20
|
end
|
21
21
|
|
data/lib/oxidized/model/saos.rb
CHANGED
@@ -4,12 +4,29 @@ class SAOS < Oxidized::Model
|
|
4
4
|
# Ciena SAOS switch
|
5
5
|
# used for 6.x devices
|
6
6
|
|
7
|
-
comment
|
7
|
+
comment '! '
|
8
|
+
prompt /^[\w-]+\*?>\s?/
|
8
9
|
|
9
10
|
cmd :all do |cfg|
|
11
|
+
cfg.gsub! /(Waiting for )(accounting|authorization).*\n/, '' # Remove TACACS errors
|
10
12
|
cfg.cut_both
|
11
13
|
end
|
12
14
|
|
15
|
+
cmd 'chassis show device-id power' do |cfg|
|
16
|
+
comment cfg
|
17
|
+
end
|
18
|
+
|
19
|
+
cmd 'software show' do |cfg|
|
20
|
+
cfg.gsub! /^\| Bank status.*/, '| Bank status : <removed> |'
|
21
|
+
comment cfg
|
22
|
+
end
|
23
|
+
|
24
|
+
cmd 'port xcvr show' do |cfg|
|
25
|
+
cfg.gsub! /^SHELL PARSER FAILURE.*/, '' # Ignore command failure
|
26
|
+
cfg.gsub! /(\s\|.{10}\|)(Ena\s\s|\s\sDis|UCTF\s)(.*)/, '\1 \3' # Remove transient operational state
|
27
|
+
comment cfg
|
28
|
+
end
|
29
|
+
|
13
30
|
cmd 'configuration show' do |cfg|
|
14
31
|
cfg.gsub! /^! Created: [^\n]*\n/, ''
|
15
32
|
cfg.gsub! /^! On terminal: [^\n]*\n/, ''
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class SikluMHTG < Oxidized::Model
|
2
|
+
using Refinements
|
3
|
+
|
4
|
+
# Siklu MultiHaul TG#
|
5
|
+
# Requires source to define the model as SikluMHTG #
|
6
|
+
|
7
|
+
prompt /^\r?MH-[TN]\d{3}[\@][\w]{2,8}>$/
|
8
|
+
|
9
|
+
expect /--More--/ do |data, re|
|
10
|
+
send ' '
|
11
|
+
data.sub re, ''
|
12
|
+
end
|
13
|
+
|
14
|
+
cmd 'show startup' do |cfg|
|
15
|
+
cfg.gsub! /[\b]|\e\[A|\e\[2K/, ''
|
16
|
+
cfg.cut_both
|
17
|
+
end
|
18
|
+
|
19
|
+
cfg :ssh do
|
20
|
+
pre_logout 'quit'
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
class UPLINKOLT < Oxidized::Model
|
2
|
+
prompt /^([\w.@()-]+[#>]\s?)$/
|
3
|
+
comment '! '
|
4
|
+
|
5
|
+
cmd :all do |cfg|
|
6
|
+
cfg.gsub! /^% Invalid input detected at '\^' marker\.$|^\s+\^$/, ''
|
7
|
+
cfg.gsub!(/^show running-config$/, '')
|
8
|
+
cfg.gsub!(/^.*\s*#\s*$/, '')
|
9
|
+
# Remove leading and trailing whitespace
|
10
|
+
cfg.strip!
|
11
|
+
# Remove empty lines
|
12
|
+
cfg.gsub!(/^\s*$/, '')
|
13
|
+
cfg
|
14
|
+
end
|
15
|
+
|
16
|
+
cmd 'configure terminal' do
|
17
|
+
# Enter configure terminal mode
|
18
|
+
cmd 'show version' do |cfg|
|
19
|
+
cfg.gsub! /^show version/, ''
|
20
|
+
comment cfg
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
cmd 'show running-config' do |cfg|
|
25
|
+
cfg.gsub! /^Current configuration:/, ''
|
26
|
+
cfg
|
27
|
+
end
|
28
|
+
|
29
|
+
cfg :telnet, :ssh do
|
30
|
+
username /^Login:/i
|
31
|
+
password /^Password:/i
|
32
|
+
# preferred way to handle additional passwords
|
33
|
+
post_login do
|
34
|
+
if vars(:enable) == true
|
35
|
+
cmd "enable"
|
36
|
+
elsif vars(:enable)
|
37
|
+
cmd "enable", /^[pP]assword:/
|
38
|
+
cmd vars(:enable)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
post_login 'terminal length 0'
|
42
|
+
pre_logout 'exit'
|
43
|
+
pre_logout 'disable'
|
44
|
+
pre_logout 'exit'
|
45
|
+
end
|
46
|
+
end
|
@@ -3,7 +3,7 @@ class Vyatta < Oxidized::Model
|
|
3
3
|
|
4
4
|
# Brocade Vyatta / VyOS model #
|
5
5
|
|
6
|
-
prompt
|
6
|
+
prompt /@.*(:~\$|>)\s/
|
7
7
|
|
8
8
|
cmd :all do |cfg|
|
9
9
|
cfg.lines.to_a[1..-2].join
|
@@ -14,7 +14,7 @@ class Vyatta < Oxidized::Model
|
|
14
14
|
cfg.gsub! /plaintext-password (\S+).*/, 'plaintext-password <secret removed>'
|
15
15
|
cfg.gsub! /password (\S+).*/, 'password <secret removed>'
|
16
16
|
cfg.gsub! /pre-shared-secret (\S+).*/, 'pre-shared-secret <secret removed>'
|
17
|
-
cfg.gsub! /community (\S+)
|
17
|
+
cfg.gsub! /community (\S+)/, 'community <hidden>'
|
18
18
|
cfg.gsub! /private-key (\S+).*/, 'private-key <secret removed>'
|
19
19
|
cfg.gsub! /preshared-key (\S+).*/, 'preshared-key <secret removed>'
|
20
20
|
cfg
|
data/lib/oxidized/model/xos.rb
CHANGED
@@ -12,6 +12,13 @@ class XOS < Oxidized::Model
|
|
12
12
|
cfg.each_line.to_a[1..-2].map { |line| line.delete("\r").rstrip }.join("\n") + "\n"
|
13
13
|
end
|
14
14
|
|
15
|
+
cmd :secret do |cfg|
|
16
|
+
cfg.gsub! /^(configure radius (netlogin|mgmt-access) (primary|secondary) shared-secret encrypted).+/, '\\1 <secret hidden>'
|
17
|
+
cfg.gsub! /^(configure account admin encrypted).+/, '\\1 <secret hidden>'
|
18
|
+
cfg.gsub! /^(create account (admin|user) (.+) encrypted).+/, '\\1 <secret hidden>'
|
19
|
+
cfg
|
20
|
+
end
|
21
|
+
|
15
22
|
cmd 'show version' do |cfg|
|
16
23
|
comment cfg
|
17
24
|
end
|