oxidized 0.27.0 → 0.28.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/publishdocker.yml +13 -0
  3. data/.rubocop.yml +10 -1
  4. data/.rubocop_todo.yml +12 -4
  5. data/CHANGELOG.md +646 -409
  6. data/docs/Configuration.md +4 -1
  7. data/docs/Hooks.md +1 -0
  8. data/docs/Model-Notes/{ios.md → IOS.md} +1 -1
  9. data/docs/Model-Notes/LinuxGeneric.md +4 -3
  10. data/docs/Model-Notes/README.md +1 -1
  11. data/docs/Model-Notes/Viptela.md +1 -1
  12. data/docs/Ruby-API.md +13 -1
  13. data/docs/Supported-OS-Types.md +14 -1
  14. data/lib/oxidized/input/http.rb +14 -4
  15. data/lib/oxidized/input/ssh.rb +1 -1
  16. data/lib/oxidized/input/telnet.rb +1 -1
  17. data/lib/oxidized/model/aos7.rb +2 -2
  18. data/lib/oxidized/model/aosw.rb +5 -0
  19. data/lib/oxidized/model/ciscosmb.rb +13 -2
  20. data/lib/oxidized/model/cnos.rb +33 -0
  21. data/lib/oxidized/model/cumulus.rb +1 -4
  22. data/lib/oxidized/model/edgecos.rb +13 -3
  23. data/lib/oxidized/model/eos.rb +1 -0
  24. data/lib/oxidized/model/fortios.rb +6 -6
  25. data/lib/oxidized/model/gcombnps.rb +4 -4
  26. data/lib/oxidized/model/ibos.rb +55 -0
  27. data/lib/oxidized/model/ios.rb +1 -1
  28. data/lib/oxidized/model/ironware.rb +1 -1
  29. data/lib/oxidized/model/nsxconfig.rb +22 -0
  30. data/lib/oxidized/model/nsxfirewall.rb +22 -0
  31. data/lib/oxidized/model/os10.rb +46 -0
  32. data/lib/oxidized/model/procurve.rb +2 -2
  33. data/lib/oxidized/model/qtech.rb +41 -0
  34. data/lib/oxidized/model/routeros.rb +3 -3
  35. data/lib/oxidized/model/sonicos.rb +5 -0
  36. data/lib/oxidized/model/telco.rb +24 -0
  37. data/lib/oxidized/model/xos.rb +2 -2
  38. data/lib/oxidized/node.rb +2 -2
  39. data/lib/oxidized/nodes.rb +1 -1
  40. data/lib/oxidized/output/git.rb +1 -1
  41. data/lib/oxidized/version.rb +2 -2
  42. data/oxidized.gemspec +2 -2
  43. metadata +16 -8
@@ -16,6 +16,8 @@ input:
16
16
  debug: true
17
17
  ssh:
18
18
  secure: false
19
+ http:
20
+ ssl_verify: true
19
21
  ```
20
22
 
21
23
  ## Privileged mode
@@ -82,7 +84,7 @@ vars:
82
84
 
83
85
  ## Public Key Authentication with SSH
84
86
 
85
- Instead of password-based login, Oxidized can make use of key-based SSH authentication.
87
+ Instead of password-based login, Oxidized can make use of key-based SSH authentication.
86
88
 
87
89
  You can tell Oxidized to use one or more private keys globally, or specify the key to be used on a per-node basis. The latter can be done by mapping the `ssh_keys` variable through the active source.
88
90
 
@@ -306,5 +308,6 @@ resolve_dns: false
306
308
  ## Environment variables
307
309
 
308
310
  You can use some environment variables to change default root directories values.
311
+
309
312
  * `OXIDIZED_HOME` may be used to set oxidized configuration directory, which defaults to `~/.config/oxidized`
310
313
  * `OXIDIZED_LOGS` may be used to set oxidzied logs and crash directories root, which default to `~/.config/oxidized`
@@ -168,6 +168,7 @@ hooks:
168
168
  token: SLACK_BOT_TOKEN
169
169
  channel: "#network-changes"
170
170
  ```
171
+
171
172
  The token parameter is a "legacy token" and is generated [Here](https://api.slack.com/custom-integrations/legacy-tokens).
172
173
 
173
174
  Optionally you can disable snippets and post a formatted message, for instance linking to a commit in a git repo. Named parameters `%{node}`, `%{group}`, `%{model}` and `%{commitref}` are available.
@@ -1,6 +1,6 @@
1
1
  # Cisco IOS Switches
2
2
 
3
- ## Include unsaved changes done on a device (commented) with each configuration.
3
+ ## Include unsaved changes done on a device (commented) with each configuration
4
4
 
5
5
  Create the file `~/.config/oxidized/model/ios.rb` with the following contents to extend the IOS model:
6
6
 
@@ -2,22 +2,23 @@
2
2
 
3
3
  To expand the usage of this model for more specific needs you can create a file in `~/.config/oxidized/model/linuxgeneric.rb`
4
4
 
5
- ```
5
+ ```ruby
6
6
  require 'oxidized/model/linuxgeneric.rb'
7
7
 
8
8
  class LinuxGeneric
9
9
 
10
10
  cmd :secret, clear: true do |cfg|
11
- cfg.gsub! /^(default (\S+).* (expires) ).*/, '\\1 <redacted>'
11
+ cfg.gsub! /^(default (\S+).* (expires) ).*/, '\\1 <redacted>'
12
12
  cfg
13
13
  end
14
-
14
+
15
15
  post do
16
16
  cfg = add_comment 'THE MONKEY PATCH'
17
17
  cfg += cmd 'firewall-cmd --list-all --zone=public'
18
18
  end
19
19
  end
20
20
  ```
21
+
21
22
  See [Extending-Model](https://github.com/ytti/oxidized/blob/master/docs/Creating-Models.md#creating-and-extending-models)
22
23
 
23
24
  Back to [Model-Notes](README.md)
@@ -13,7 +13,7 @@ Arista|[EOS](EOS.md)|05 Feb 2018
13
13
  Cumulus|[Cumulus](Cumulus.md)|11 Jun 2018
14
14
  Huawei|[VRP](VRP-Huawei.md)|17 Nov 2017
15
15
  Huawei|[SmartAX series](SmartAX-Huawei.md)|21 Jan 2019
16
- Cisco IOS|[IOS](ios.md)|29 Mar 2019
16
+ Cisco IOS|[IOS](IOS.md)|29 Mar 2019
17
17
  Juniper|[MX/QFX/EX/SRX/J Series](JunOS.md)|18 Jan 2018
18
18
  Netgear|[Netgear](Netgear.md)|11 Apr 2018
19
19
  Nokia|[Nokia ISAM](Nokia.md)|22 Aug 2018
@@ -9,4 +9,4 @@ Pagination is disabled post login.
9
9
  - show running-config
10
10
  - show version
11
11
 
12
- Back to [Model-Notes](README.md)
12
+ Back to [Model-Notes](README.md)
@@ -6,7 +6,19 @@ The following objects exist in Oxidized.
6
6
 
7
7
  * gets config from nodes
8
8
  * must implement 'connect', 'get', 'cmd'
9
- * 'ssh', 'telnet', 'ftp', and 'tftp' implemented
9
+ * 'ssh', 'telnet', 'ftp', 'tftp', 'http' implemented
10
+
11
+ #### http
12
+ * Communicates with a device over http/https
13
+ * Configurable variables from within model @username, @password, @headers.
14
+ * @username,@password are used in a Basic Authentication method.
15
+ * @headers is a Hash of key value pairs of headers to pass along with the request.
16
+ * Within the sources config under input you define a YAML stanza like the below, this will tell Oxidized to validate certificates on the request
17
+ ```yaml
18
+ input:
19
+ http:
20
+ ssl_verify: true
21
+ ```
10
22
 
11
23
  ## Output
12
24
 
@@ -49,6 +49,8 @@
49
49
  * [Cambium (PMP450 Series)](/lib/oxidized/model/cambium.rb)
50
50
  * Casa
51
51
  * [Casa](/lib/oxidized/model/casa.rb)
52
+ * Centec Networks
53
+ * [CNOS](/lib/oxidized/model/cnos.rb)
52
54
  * Check Point
53
55
  * [GaiaOS](/lib/oxidized/model/gaiaos.rb)
54
56
  * Ciena
@@ -88,6 +90,7 @@
88
90
  * [PowerConnect](/lib/oxidized/model/powerconnect.rb)
89
91
  * [AOSW](/lib/oxidized/model/aosw.rb)
90
92
  * [DellX](/lib/oxidized/model/dellx.rb)
93
+ * [Dell EMC Networking OS10](/lib/oxidized/model/os10.rb)
91
94
  * D-Link
92
95
  * [D-Link](/lib/oxidized/model/dlink.rb)
93
96
  * ECI Telecom
@@ -105,6 +108,9 @@
105
108
  * [TMOS](/lib/oxidized/model/tmos.rb)
106
109
  * Fiberstore
107
110
  * [S3800](/lib/oxidized/model/gcombnps.rb)
111
+ * [S3900](/lib/oxidized/model/edgecos.rb)
112
+ * [S5800](/lib/oxidized/model/cnos.rb)
113
+ * [S5850](/lib/oxidized/model/cnos.rb)
108
114
  * Firebrick
109
115
  * [FBxxxx](/lib/oxidized/model/firebrick.rb)
110
116
  * Force10
@@ -174,12 +180,14 @@
174
180
  * [AlteonOS](/lib/oxidized/model/alteonos.rb)
175
181
  * Raisecom
176
182
  * [Raisecom](/lib/oxidized/model/raisecom.rb)
183
+ * QTECH
184
+ * [QSW-2800, QSW-3400, QSW-3450, QSW-3500](/lib/oxidized/model/qtech.rb)
177
185
  * Quanta
178
186
  * [Quanta / VxWorks 6.6 (1.1.0.8)](/lib/oxidized/model/quantaos.rb)
179
187
  * Siklu
180
188
  * [EtherHaul](/lib/oxidized/model/siklu.rb)
181
189
  * SonicWALL
182
- * [SonicOS](lib/oxidized/model/sonicos.rb)
190
+ * [SonicOS](lib/oxidized/model/sonicos.rb)
183
191
  * SNR
184
192
  * [SNR-S300G, S2xxx, S3xxx, S4xxx](/lib/oxidized/model/dcnos.rb)
185
193
  * Speedtouch
@@ -191,6 +199,8 @@
191
199
  * [SBM-GEM-X2C, GEM-X2C+, GEM-X3S+, XEM-X10SM](/lib/oxidized/model/aricentiss.rb)
192
200
  * Symantec
193
201
  * [Blue Coat ProxySG / Security Gateway OS (SGOS)](/lib/oxidized/model/sgos.rb)
202
+ * Telco Systems
203
+ * [Telco Systems T-Marc 3306](/lib/oxidized/model/telco.rb)
194
204
  * Trango Systems
195
205
  * [Trango](/lib/oxidized/model/trango.rb)
196
206
  * TPLink
@@ -202,6 +212,9 @@
202
212
  * [Edgeos](/lib/oxidized/model/edgeos.rb)
203
213
  * [EdgeSwitch](/lib/oxidized/model/edgeswitch.rb)
204
214
  * [AirFiber](/lib/oxidized/model/airfiber.rb)
215
+ * VMWare
216
+ * [NSX Edge (configuration)](/lib/oxidized/model/nsxconfig.rb)
217
+ * [NSX Edge (firewall rules)](/lib/oxidized/model/nsxfirewall.rb)
205
218
  * Watchguard
206
219
  * [Fireware OS](/lib/oxidized/model/firewareos.rb)
207
220
  * Westell
@@ -9,6 +9,9 @@ module Oxidized
9
9
  def connect(node)
10
10
  @node = node
11
11
  @secure = false
12
+ @username = nil
13
+ @password = nil
14
+ @headers = {}
12
15
  @log = File.open(Oxidized::Config::Log + "/#{@node.ip}-http", "w") if Oxidized.config.input.debug?
13
16
  @node.model.cfg["http"].each { |cb| instance_exec(&cb) }
14
17
 
@@ -45,10 +48,17 @@ module Oxidized
45
48
 
46
49
  def get_http(path)
47
50
  schema = @secure ? "https://" : "http://"
48
- uri = URI.join schema + @node.ip, path
49
- http = Net::HTTP.new uri.host, uri.port
50
- http.use_ssl = true if uri.scheme == "https"
51
- http.get(uri).body
51
+ uri = URI("#{schema}#{@node.ip}#{path}")
52
+ req = Net::HTTP::Get.new(uri)
53
+ req.basic_auth @username, @password unless @username.nil?
54
+ @headers.each do |header, value|
55
+ req.add_field(header, value)
56
+ end
57
+ ssl_verify = Oxidized.config.input.http.ssl_verify? ? OpenSSL::SSL::VERIFY_PEER : OpenSSL::SSL::VERIFY_NONE
58
+ res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https", verify_mode: ssl_verify) do |http|
59
+ http.request(req)
60
+ end
61
+ res.body
52
62
  end
53
63
 
54
64
  def log(str)
@@ -65,7 +65,7 @@ module Oxidized
65
65
  disconnect_cli
66
66
  # if disconnect does not disconnect us, give up after timeout
67
67
  Timeout.timeout(Oxidized.config.timeout) { @ssh.loop }
68
- rescue Errno::ECONNRESET, Net::SSH::Disconnect, IOError # rubocop:disable Lint/HandleExceptions
68
+ rescue Errno::ECONNRESET, Net::SSH::Disconnect, IOError
69
69
  ensure
70
70
  @log.close if Oxidized.config.input.debug?
71
71
  (@ssh.close rescue true) unless @ssh.closed?
@@ -61,7 +61,7 @@ module Oxidized
61
61
  def disconnect
62
62
  disconnect_cli
63
63
  @telnet.close
64
- rescue Errno::ECONNRESET # rubocop:disable Lint/HandleExceptions
64
+ rescue Errno::ECONNRESET
65
65
  ensure
66
66
  @log.close if Oxidized.config.input.debug?
67
67
  (@telnet.close rescue true) unless @telnet.sock.closed?
@@ -47,8 +47,8 @@ class AOS7 < Oxidized::Model
47
47
  end
48
48
 
49
49
  cfg :telnet do
50
- username /^login : /
51
- password /^Password : /
50
+ username /^([\w -])*login: /
51
+ password /^Password\s?: /
52
52
  end
53
53
 
54
54
  cfg :telnet, :ssh do
@@ -58,6 +58,11 @@ class AOSW < Oxidized::Model
58
58
  rstrip_cfg comment cfg
59
59
  end
60
60
 
61
+ cmd 'show license passphrase' do |cfg|
62
+ cfg = "" if cfg.match /(Invalid input detected at '\^' marker|Parse error)/ # Don't show for unsupported devices (IAP and MAS)
63
+ rstrip_cfg comment cfg
64
+ end
65
+
61
66
  cmd 'show running-config' do |cfg|
62
67
  out = []
63
68
  cfg.each_line do |line|
@@ -26,6 +26,7 @@ class CiscoSMB < Oxidized::Model
26
26
  end
27
27
 
28
28
  cmd 'show version' do |cfg|
29
+ cfg.gsub! /uptime is\ .+/, '<uptime removed>'
29
30
  comment cfg
30
31
  end
31
32
 
@@ -44,8 +45,18 @@ class CiscoSMB < Oxidized::Model
44
45
  end
45
46
 
46
47
  cfg :telnet, :ssh do
47
- username /^User ?[nN]ame:/
48
- password /^\r?Password:$/
48
+ username /User ?[nN]ame:/
49
+ password /^\r?Password:/
50
+
51
+ post_login do
52
+ if vars(:enable) == true
53
+ cmd 'enable'
54
+ elsif vars(:enable)
55
+ cmd 'enable', /^\r?Password:$/
56
+ cmd vars(:enable)
57
+ end
58
+ end
59
+
49
60
  post_login 'terminal datadump' # Disable pager
50
61
  post_login 'terminal width 0'
51
62
  post_login 'terminal len 0'
@@ -0,0 +1,33 @@
1
+ # model for Centec Networks CNOS based switches
2
+ class CNOS < Oxidized::Model
3
+ comment '! '
4
+
5
+ cmd :all do |cfg|
6
+ cfg.each_line.to_a[0..-2].join
7
+ end
8
+
9
+ cmd 'show running-config' do |cfg|
10
+ cfg.gsub!(/(snmp-server community )(\S+)/, '\1<hidden>')
11
+ cfg.gsub!(/key type private.+key string end/m, '<private key hidden>')
12
+ cfg
13
+ end
14
+
15
+ cmd 'show version' do |cfg|
16
+ cfg.gsub! /^(.* uptime is ).*\n/, '\1'
17
+ comment cfg
18
+ end
19
+
20
+ cmd 'show transceiver' do |cfg|
21
+ comment cfg
22
+ end
23
+
24
+ cfg :telnet do
25
+ username /^Username:/
26
+ password /^Password:/
27
+ end
28
+
29
+ cfg :telnet, :ssh do
30
+ post_login 'terminal length 0'
31
+ pre_logout 'exit'
32
+ end
33
+ end
@@ -33,9 +33,6 @@ class Cumulus < Oxidized::Model
33
33
  cfg += add_comment 'NTP.CONF'
34
34
  cfg += cmd 'cat /etc/ntp.conf'
35
35
 
36
- cfg += add_comment 'IP Routes'
37
- cfg += cmd 'netstat -rn'
38
-
39
36
  cfg += add_comment 'SNMP settings'
40
37
  cfg += cmd 'cat /etc/snmp/snmpd.conf'
41
38
 
@@ -73,7 +70,7 @@ class Cumulus < Oxidized::Model
73
70
  cfg += cmd 'cat /etc/cumulus/datapath/traffic.conf'
74
71
 
75
72
  cfg += add_comment 'ACL'
76
- cfg += cmd 'iptables -L -n'
73
+ cfg += cmd 'cat /etc/cumulus/acl/policy.conf'
77
74
 
78
75
  cfg += add_comment 'VERSION'
79
76
  cfg += cmd 'cat /etc/cumulus/etc.replace/os-release'
@@ -8,14 +8,14 @@ class EdgeCOS < Oxidized::Model
8
8
  end
9
9
 
10
10
  cmd :all do |cfg|
11
- cfg.each_line.to_a[2..-2].join
11
+ cfg.each_line.to_a[0..-2].join
12
12
  end
13
13
 
14
14
  cmd 'show running-config'
15
15
 
16
16
  cmd 'show system' do |cfg|
17
- cfg.gsub! /^\s*System Up Time\s*:.*\n/i, ''
18
- cfg.gsub! /^\s*(Temperature \d*:).*\n/i, '\\1 <removed>'
17
+ cfg.gsub! /^.*\sUp Time\s*:.*\n/i, ''
18
+ cfg.gsub! /^(.*\sTemperature \d*:).*\n/i, '\\1 <removed>'
19
19
  comment cfg
20
20
  end
21
21
 
@@ -27,6 +27,16 @@ class EdgeCOS < Oxidized::Model
27
27
  comment cfg
28
28
  end
29
29
 
30
+ cmd 'show interfaces transceiver' do |cfg|
31
+ cfg.gsub! /(\d\d)!/, '\\1 ' # alarm indicators of DDM thresholds
32
+ cfg.gsub! /^(\s*Temperature\s*:).*/, '\1 <hidden>'
33
+ cfg.gsub! /^(\s*Vcc\s*:).*/, '\1 <hidden>'
34
+ cfg.gsub! /^(\s*Bias Current\s*:).*/, '\1 <hidden>'
35
+ cfg.gsub! /^(\s*TX Power\s*:).*/, '\1 <hidden>'
36
+ cfg.gsub! /^(\s*RX Power\s*:).*/, '\1 <hidden>'
37
+ comment cfg
38
+ end
39
+
30
40
  cfg :telnet do
31
41
  username /^Username:/
32
42
  password /^Password:/
@@ -15,6 +15,7 @@ class EOS < Oxidized::Model
15
15
  cfg.gsub! /(password \d+) (\S+).*/, '\\1 <secret hidden>'
16
16
  cfg.gsub! /^(enable secret).*/, '\\1 <configuration removed>'
17
17
  cfg.gsub! /^(tacacs-server key \d+).*/, '\\1 <configuration removed>'
18
+ cfg.gsub! /( {6}key) (\h+ 7) (\h+).*/, '\\1 <secret hidden>'
18
19
  cfg
19
20
  end
20
21
 
@@ -20,16 +20,16 @@ class FortiOS < Oxidized::Model
20
20
  # A number of other statements also contains sensitive strings
21
21
  cfg.gsub! /(set (?:passwd|password|key|group-password|auth-password-l1|auth-password-l2|rsso|history0|history1)) .+/, '\\1 <configuration removed>'
22
22
  cfg.gsub! /(set md5-key [0-9]+) .+/, '\\1 <configuration removed>'
23
- cfg.gsub! /(set private-key ).*?-+END (ENCRYPTED|RSA) PRIVATE KEY-*"$/m, '\\1<configuration removed>'
24
- cfg.gsub! /(set ca ).*?-+END CERTIFICATE-*"$/m, '\\1<configuration removed>'
25
- cfg.gsub! /(set csr ).*?-+END CERTIFICATE REQUEST-*"$/m, '\\1<configuration removed>'
26
- cfg.gsub! /(Cluster uptime:).*/, '\\1 <stripped>'
23
+ cfg.gsub! /(set private-key ).*?-+END (ENCRYPTED|RSA|OPENSSH) PRIVATE KEY-+\n?"$/m, '\\1<configuration removed>'
24
+ cfg.gsub! /(set ca ).*?-+END CERTIFICATE-+"$/m, '\\1<configuration removed>'
25
+ cfg.gsub! /(set csr ).*?-+END CERTIFICATE REQUEST-+"$/m, '\\1<configuration removed>'
27
26
  cfg
28
27
  end
29
28
 
30
29
  cmd 'get system status' do |cfg|
31
- @vdom_enabled = cfg.include? 'Virtual domain configuration: enable'
32
- cfg.gsub!(/(System time: )(.*)/, '\1<stripped>\3')
30
+ @vdom_enabled = cfg.match /Virtual domain configuration: (enable|multiple)/
31
+ cfg.gsub! /(System time:).*/, '\\1 <stripped>'
32
+ cfg.gsub! /(Cluster uptime:).*/, '\\1 <stripped>'
33
33
  cfg.gsub! /(Virus-DB|Extended DB|IPS-DB|IPS-ETDB|APP-DB|INDUSTRIAL-DB|Botnet DB|IPS Malicious URL Database).*/, '\\1 <db version stripped>'
34
34
  comment cfg
35
35
  end
@@ -5,11 +5,11 @@ class GcomBNPS < Oxidized::Model
5
5
  # tested with:
6
6
  # - S5330 (aka Fiberstore S3800)
7
7
 
8
- prompt /^\r?([\w.@()-]+?(\(1-16 chars\))?[#>:]\s?)$/ # also match SSH password promt (post_login commands are sent after the first prompt)
8
+ prompt /^\r?([\w.@()-]+?(\(1-\d+ chars\))?[#>:]\s?)$/ # also match SSH password promt (post_login commands are sent after the first prompt)
9
9
  comment '! '
10
10
 
11
11
  # alternative to handle the SSH login, but this breaks telnet
12
- # expect /^Password\(1-16 chars\):/ do |data|
12
+ # expect /^Password\(1-\d+ chars\):/ do |data|
13
13
  # send @node.auth[:password] + "\n"
14
14
  # ''
15
15
  # end
@@ -66,8 +66,8 @@ class GcomBNPS < Oxidized::Model
66
66
  end
67
67
 
68
68
  cfg :telnet do
69
- username /^Username\(1-32 chars\):/
70
- password /^Password\(1-16 chars\):/
69
+ username /^Username\(1-\d+ chars\):/
70
+ password /^Password\(1-\d+ chars\):/
71
71
  end
72
72
 
73
73
  cfg :ssh do
@@ -0,0 +1,55 @@
1
+ class IBOS < Oxidized::Model
2
+ # IBOS model, Intelligent Broadband Operating System (iBOS)
3
+ # Used in Waystream (previously PacketFront) Routers and Switches
4
+
5
+ prompt /^([\w.@()-]+[#>]\s?)$/
6
+ comment '! '
7
+
8
+ cmd :all do |cfg|
9
+ cfg.each_line.to_a[1..-2].join
10
+ end
11
+
12
+ cmd :secret do |cfg|
13
+ # snmp-group version 2c
14
+ # notify 10.1.1.1 community public trap
15
+ cfg.gsub! /^ notify (\S+) community (\S+) (.*)/, ' notify \\1 community <hidden> \\3'
16
+
17
+ # snmp-group version 2c
18
+ # community public read-only view all
19
+ cfg.gsub! /^ community (\S+) (.*)/, ' community <hidden> \\2'
20
+
21
+ # radius server 10.1.1.1 secret public
22
+ cfg.gsub! /^radius server (\S+) secret (\S+)(.*)/, 'radius server \\1 secret <hidden> \\3'
23
+ end
24
+
25
+ cmd 'show version' do |cfg|
26
+ cfg.gsub! /.*uptime is.*/, ''
27
+ comment cfg
28
+ end
29
+
30
+ cmd 'show running-config' do |cfg|
31
+ cfg = cfg.each_line.to_a[0..-1].join
32
+ cfg.gsub! /.*!volatile.*/, ''
33
+ cfg
34
+ end
35
+
36
+ cfg :telnet do
37
+ username /^username:\s/
38
+ password /^\r?password:\s/
39
+ end
40
+
41
+ cfg :telnet, :ssh do
42
+ # preferred way to handle additional passwords
43
+ post_login do
44
+ if vars(:enable) == true
45
+ cmd "enable"
46
+ elsif vars(:enable)
47
+ cmd "enable", /^[pP]assword:/
48
+ cmd vars(:enable)
49
+ end
50
+ end
51
+ post_login 'terminal no pager'
52
+ post_login 'terminal width 65535'
53
+ pre_logout 'exit'
54
+ end
55
+ end