oxidized 0.20.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +1 -1
- data/README.md +135 -865
- data/docs/Configuration.md +186 -0
- data/docs/Hooks.md +143 -0
- data/docs/Outputs.md +190 -0
- data/docs/Ruby-API.md +115 -0
- data/docs/Sources.md +110 -0
- data/docs/Supported-OS-Types.md +149 -0
- data/docs/VRP-Huawei.md +27 -0
- data/extra/oxidized-report-git-commits +21 -40
- data/extra/oxidized-ubuntu.haproxy +45 -0
- data/extra/oxidized.service +4 -0
- data/lib/oxidized/hook.rb +1 -0
- data/lib/oxidized/hook/exec.rb +0 -1
- data/lib/oxidized/input/ssh.rb +11 -8
- data/lib/oxidized/model/acsw.rb +67 -0
- data/lib/oxidized/model/aen.rb +20 -0
- data/lib/oxidized/model/alteonos.rb +60 -0
- data/lib/oxidized/model/asa.rb +53 -18
- data/lib/oxidized/model/asyncos.rb +49 -0
- data/lib/oxidized/model/audiocodes.rb +32 -0
- data/lib/oxidized/model/boss.rb +76 -0
- data/lib/oxidized/model/ciscosma.rb +45 -0
- data/lib/oxidized/model/ciscosmb.rb +6 -1
- data/lib/oxidized/model/coriantgroove.rb +30 -0
- data/lib/oxidized/model/dlink.rb +1 -0
- data/lib/oxidized/model/enterasys.rb +30 -0
- data/lib/oxidized/model/fiberdriver.rb +1 -1
- data/lib/oxidized/model/fortios.rb +3 -1
- data/lib/oxidized/model/ftos.rb +2 -0
- data/lib/oxidized/model/hirschmann.rb +41 -0
- data/lib/oxidized/model/hpemsa.rb +13 -0
- data/lib/oxidized/model/ios.rb +2 -2
- data/lib/oxidized/model/iosxr.rb +1 -0
- data/lib/oxidized/model/ipos.rb +7 -1
- data/lib/oxidized/model/ironware.rb +4 -1
- data/lib/oxidized/model/netgear.rb +12 -4
- data/lib/oxidized/model/panos.rb +1 -1
- data/lib/oxidized/model/planet.rb +2 -1
- data/lib/oxidized/model/powerconnect.rb +5 -0
- data/lib/oxidized/model/procurve.rb +13 -0
- data/lib/oxidized/model/routeros.rb +12 -5
- data/lib/oxidized/model/sgos.rb +46 -0
- data/lib/oxidized/model/ucs.rb +31 -0
- data/lib/oxidized/model/voss.rb +12 -3
- data/lib/oxidized/model/vrp.rb +6 -0
- data/lib/oxidized/model/weos.rb +22 -0
- data/lib/oxidized/model/xos.rb +4 -0
- data/lib/oxidized/node.rb +4 -2
- data/lib/oxidized/nodes.rb +1 -0
- data/lib/oxidized/version.rb +1 -1
- data/lib/oxidized/worker.rb +23 -2
- data/oxidized.gemspec +1 -1
- metadata +54 -46
@@ -0,0 +1,45 @@
|
|
1
|
+
global
|
2
|
+
log /dev/log local0
|
3
|
+
log /dev/log local1 notice
|
4
|
+
chroot /var/lib/haproxy
|
5
|
+
stats socket /run/haproxy/admin.sock mode 660 level admin
|
6
|
+
stats timeout 30s
|
7
|
+
user haproxy
|
8
|
+
group haproxy
|
9
|
+
daemon
|
10
|
+
|
11
|
+
# Default SSL material locations
|
12
|
+
ca-base /etc/ssl/certs
|
13
|
+
crt-base /etc/ssl/private
|
14
|
+
|
15
|
+
# Default ciphers to use on SSL-enabled listening sockets.
|
16
|
+
# For more information, see ciphers(1SSL). This list is from:
|
17
|
+
# https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/
|
18
|
+
ssl-default-bind-ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS
|
19
|
+
ssl-default-bind-options no-sslv3
|
20
|
+
|
21
|
+
defaults
|
22
|
+
log global
|
23
|
+
mode http
|
24
|
+
option httplog
|
25
|
+
option dontlognull
|
26
|
+
timeout connect 5000
|
27
|
+
timeout client 50000
|
28
|
+
timeout server 50000
|
29
|
+
errorfile 400 /etc/haproxy/errors/400.http
|
30
|
+
errorfile 403 /etc/haproxy/errors/403.http
|
31
|
+
errorfile 408 /etc/haproxy/errors/408.http
|
32
|
+
errorfile 500 /etc/haproxy/errors/500.http
|
33
|
+
errorfile 502 /etc/haproxy/errors/502.http
|
34
|
+
errorfile 503 /etc/haproxy/errors/503.http
|
35
|
+
errorfile 504 /etc/haproxy/errors/504.http
|
36
|
+
|
37
|
+
frontend oxidized
|
38
|
+
bind *:80
|
39
|
+
mode http
|
40
|
+
default_backend oxidized
|
41
|
+
compression algo gzip
|
42
|
+
compression type text/html text/plain text/css
|
43
|
+
|
44
|
+
backend oxidized
|
45
|
+
server o1 127.0.0.1:8080
|
data/extra/oxidized.service
CHANGED
@@ -1,12 +1,16 @@
|
|
1
1
|
#For debian 8 put it in /lib/systemd/system/
|
2
|
+
#For RHEL / CentOS 7 put it in /etc/systemd/system/
|
2
3
|
#and call it with systemctl start oxidized.service
|
3
4
|
|
4
5
|
[Unit]
|
5
6
|
Description=Oxidized - Network Device Configuration Backup Tool
|
7
|
+
After=network-online.target multi-user.target
|
8
|
+
Wants=network-online.target
|
6
9
|
|
7
10
|
[Service]
|
8
11
|
ExecStart=/usr/local/bin/oxidized
|
9
12
|
User=oxidized
|
13
|
+
KillSignal=SIGINT
|
10
14
|
|
11
15
|
[Install]
|
12
16
|
WantedBy=multi-user.target
|
data/lib/oxidized/hook.rb
CHANGED
data/lib/oxidized/hook/exec.rb
CHANGED
@@ -71,7 +71,6 @@ class Exec < Oxidized::Hook
|
|
71
71
|
"OX_NODE_FROM" => ctx.node.from.to_s,
|
72
72
|
"OX_NODE_MSG" => ctx.node.msg.to_s,
|
73
73
|
"OX_NODE_GROUP" => ctx.node.group.to_s,
|
74
|
-
"OX_EVENT" => ctx.event.to_s,
|
75
74
|
"OX_REPO_COMMITREF" => ctx.commitref.to_s,
|
76
75
|
"OX_REPO_NAME" => ctx.node.repo.to_s,
|
77
76
|
)
|
data/lib/oxidized/input/ssh.rb
CHANGED
@@ -24,20 +24,23 @@ module Oxidized
|
|
24
24
|
secure = Oxidized.config.input.ssh.secure
|
25
25
|
@log = File.open(Oxidized::Config::Log + "/#{@node.ip}-ssh", 'w') if Oxidized.config.input.debug?
|
26
26
|
port = vars(:ssh_port) || 22
|
27
|
+
|
28
|
+
ssh_opts = {
|
29
|
+
:port => port.to_i,
|
30
|
+
:password => @node.auth[:password], :timeout => Oxidized.config.timeout,
|
31
|
+
:paranoid => secure,
|
32
|
+
:auth_methods => %w(none publickey password keyboard-interactive),
|
33
|
+
:number_of_password_prompts => 0,
|
34
|
+
}
|
35
|
+
|
27
36
|
if proxy_host = vars(:ssh_proxy)
|
28
37
|
proxy_command = "ssh "
|
29
38
|
proxy_command += "-o StrictHostKeyChecking=no " unless secure
|
30
39
|
proxy_command += "#{proxy_host} -W %h:%p"
|
31
40
|
proxy = Net::SSH::Proxy::Command.new(proxy_command)
|
41
|
+
ssh_opts[:proxy] = proxy
|
32
42
|
end
|
33
|
-
|
34
|
-
:port => port.to_i,
|
35
|
-
:password => @node.auth[:password], :timeout => Oxidized.config.timeout,
|
36
|
-
:paranoid => secure,
|
37
|
-
:auth_methods => %w(none publickey password keyboard-interactive),
|
38
|
-
:number_of_password_prompts => 0,
|
39
|
-
:proxy => proxy,
|
40
|
-
}
|
43
|
+
|
41
44
|
ssh_opts[:keys] = vars(:ssh_keys).is_a?(Array) ? vars(:ssh_keys) : [vars(:ssh_keys)] if vars(:ssh_keys)
|
42
45
|
ssh_opts[:kex] = vars(:ssh_kex).split(/,\s*/) if vars(:ssh_kex)
|
43
46
|
ssh_opts[:encryption] = vars(:ssh_encryption).split(/,\s*/) if vars(:ssh_encryption)
|
@@ -0,0 +1,67 @@
|
|
1
|
+
class ACSW < Oxidized::Model
|
2
|
+
|
3
|
+
prompt /([\w.@()\/\\-]+[#>]\s?)/
|
4
|
+
comment '! '
|
5
|
+
|
6
|
+
cmd :all do |cfg|
|
7
|
+
cfg.gsub! /^% Invalid input detected at '\^' marker\.$|^\s+\^$/, ''
|
8
|
+
cfg.each_line.to_a[1..-2].join
|
9
|
+
end
|
10
|
+
|
11
|
+
cmd :secret do |cfg|
|
12
|
+
cfg.gsub! /^(snmp-server community).*/, '\\1 <configuration removed>'
|
13
|
+
cfg.gsub! /^(username \S+ privilege \d+) (\S+).*/, '\\1 <secret hidden>'
|
14
|
+
cfg.gsub! /^(username \S+ password \d) (\S+)/, '\\1 <secret hidden>'
|
15
|
+
cfg.gsub! /^(username \S+ secret \d) (\S+)/, '\\1 <secret hidden>'
|
16
|
+
cfg.gsub! /^(enable (password|secret) \d) (\S+)/, '\\1 <secret hidden>'
|
17
|
+
cfg.gsub! /^(\s+(?:password|secret)) (?:\d )?\S+/, '\\1 <secret hidden>'
|
18
|
+
cfg.gsub! /^(.*wpa-psk ascii \d) (\S+)/, '\\1 <secret hidden>'
|
19
|
+
cfg.gsub! /^(.*key 7) (.*)/, '\\1 <secret hidden>'
|
20
|
+
cfg.gsub! /^(tacacs-server key \d) (\S+)/, '\\1 <secret hidden>'
|
21
|
+
cfg.gsub! /^(crypto isakmp key) (\S+) (.*)/, '\\1 <secret hidden> \\3'
|
22
|
+
cfg.gsub! /^(.*key 1 md5) (\d.+)/, '\\1 <secret hidden>'
|
23
|
+
cfg.gsub! /^(.*standby \d.+authentication).*/, '\\1 <secret hidden>'
|
24
|
+
cfg.gsub! /^(.*version 2c).*/, '\\1 <secret hidden>'
|
25
|
+
cfg
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
cmd 'show version' do |cfg|
|
30
|
+
comment cfg
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
cmd 'show inventory' do |cfg|
|
35
|
+
comment cfg
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
cmd 'show running-config' do |cfg|
|
40
|
+
cfg = cfg.each_line.to_a[3..-1]
|
41
|
+
cfg = cfg.reject { |line| line.match /^ntp clock-period / }.join
|
42
|
+
cfg.gsub! /^Current configuration : [^\n]*\n/, ''
|
43
|
+
cfg.gsub! /^\ tunnel\ mpls\ traffic-eng\ bandwidth[^\n]*\n*(
|
44
|
+
(?:\ [^\n]*\n*)*
|
45
|
+
tunnel\ mpls\ traffic-eng\ auto-bw)/mx, '\1'
|
46
|
+
cfg.gsub! /^([\s\t\!]*Last configuration change ).*/, ''
|
47
|
+
cfg.gsub! /^([\s\t\!]*NVRAM config last ).*/, ''
|
48
|
+
cfg
|
49
|
+
end
|
50
|
+
|
51
|
+
cfg :telnet do
|
52
|
+
username /.*login:/
|
53
|
+
password /^Password:/
|
54
|
+
end
|
55
|
+
|
56
|
+
cfg :telnet, :ssh do
|
57
|
+
if vars :enable
|
58
|
+
post_login do
|
59
|
+
send "enable\n"
|
60
|
+
cmd vars(:enable)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
post_login 'terminal length 0'
|
64
|
+
pre_logout 'exit'
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class AEN < Oxidized::Model
|
2
|
+
# Accedian
|
3
|
+
|
4
|
+
comment '# '
|
5
|
+
|
6
|
+
prompt /^([-\w.\/:?\[\]\(\)]+:\s?)$/
|
7
|
+
|
8
|
+
cmd 'configuration generate-script module all' do |cfg|
|
9
|
+
cfg
|
10
|
+
end
|
11
|
+
|
12
|
+
cmd :all do |cfg|
|
13
|
+
cfg.each_line.to_a[1..-2].join
|
14
|
+
end
|
15
|
+
|
16
|
+
cfg :ssh do
|
17
|
+
pre_logout 'exit'
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
class ALTEONOS < Oxidized::Model
|
2
|
+
|
3
|
+
prompt /^\(?.+\)?\s?[#>]/
|
4
|
+
|
5
|
+
comment '! '
|
6
|
+
|
7
|
+
cmd :secret do |cfg|
|
8
|
+
cfg.gsub!(/^([\s\t]*admpw ).*/, '\1 <password removed>')
|
9
|
+
cfg.gsub!(/^([\s\t]*pswd ).*/, '\1 <password removed>')
|
10
|
+
cfg.gsub!(/^([\s\t]*esecret ).*/, '\1 <password removed>')
|
11
|
+
cfg
|
12
|
+
end
|
13
|
+
|
14
|
+
##############################################################################################
|
15
|
+
## Added to remove #
|
16
|
+
## #
|
17
|
+
##/* Configuration dump taken 14:10:20 Fri Jul 28, 2017 (DST) #
|
18
|
+
##/* Configuration last applied at 16:17:05 Fri Jul 14, 2017 #
|
19
|
+
##/* Configuration last save at 16:17:43 Fri Jul 14, 2017 #
|
20
|
+
##/* Version 29.0.3.12, vXXXXXXXX, Base MAC address XXXXXXXXXXX #
|
21
|
+
##/* To restore SSL Offloading configuration and management HTTPS access, #
|
22
|
+
##/* it is recommended to include the private keys in the dump. #
|
23
|
+
## OR #
|
24
|
+
##/* To restore SSL Offloading configuration and management HTTPS access,it is recommended #
|
25
|
+
##/* to include the private keys in the dump. #
|
26
|
+
## #
|
27
|
+
##############################################################################################
|
28
|
+
|
29
|
+
cmd 'cfg/dump' do |cfg|
|
30
|
+
cfg.gsub! /^([\s\t\/*]*Configuration).*/, ''
|
31
|
+
cfg.gsub! /^([\s\t\/*]*Version).*/, ''
|
32
|
+
cfg.gsub! /^([\s\t\/*]*To restore ).*/, ''
|
33
|
+
cfg.gsub! /^([\s\t\/*]*it is recommended to include).*/, ''
|
34
|
+
cfg.gsub! /^([\s\t\/*]*to include ).*/, ''
|
35
|
+
cfg
|
36
|
+
end
|
37
|
+
|
38
|
+
#Answer for Dispay private keys
|
39
|
+
expect /^Display private keys\?\s?\[y\/n\]\: $/ do |data, re|
|
40
|
+
send "n\r"
|
41
|
+
data.sub re, ''
|
42
|
+
end
|
43
|
+
|
44
|
+
#Answer for sync to peer on exit
|
45
|
+
expect /^Confirm Sync to Peer\s?\[y\/n\]\: $/ do |data, re|
|
46
|
+
send "n\r"
|
47
|
+
data.sub re, ''
|
48
|
+
end
|
49
|
+
|
50
|
+
#Answer for Unsaved configuration
|
51
|
+
expect /^(WARNING: There are unsaved configuration changes).*/ do |data, re|
|
52
|
+
send "n\r"
|
53
|
+
data.sub re, ''
|
54
|
+
end
|
55
|
+
|
56
|
+
cfg :ssh do
|
57
|
+
pre_logout 'exit'
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
data/lib/oxidized/model/asa.rb
CHANGED
@@ -20,6 +20,11 @@ class ASA < Oxidized::Model
|
|
20
20
|
cfg
|
21
21
|
end
|
22
22
|
|
23
|
+
# check for multiple contexts
|
24
|
+
cmd 'show mode' do |cfg|
|
25
|
+
@is_multiple_context = cfg.include? 'multiple'
|
26
|
+
end
|
27
|
+
|
23
28
|
cmd 'show version' do |cfg|
|
24
29
|
# avoid commits due to uptime / ixo-router01 up 2 mins 28 secs / ixo-router01 up 1 days 2 hours
|
25
30
|
cfg = cfg.each_line.select { |line| not line.match /(\s+up\s+\d+\s+)|(.*days.*)/ }
|
@@ -31,25 +36,12 @@ class ASA < Oxidized::Model
|
|
31
36
|
comment cfg
|
32
37
|
end
|
33
38
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
anyconnect_profiles.each do |profile|
|
40
|
-
cfg << (comment profile + "\n" )
|
41
|
-
cmd ("more" + profile) do |xml|
|
42
|
-
cfg << (comment xml)
|
43
|
-
end
|
39
|
+
post do
|
40
|
+
if @is_multiple_context
|
41
|
+
multiple_context
|
42
|
+
else
|
43
|
+
single_context
|
44
44
|
end
|
45
|
-
# if DAP is enabled, also backup dap.xml
|
46
|
-
if cfg.rindex(/dynamic-access-policy-record\s(?!DfltAccessPolicy)/)
|
47
|
-
cfg << (comment "disk0:/dap.xml\n")
|
48
|
-
cmd "more disk0:/dap.xml" do |xml|
|
49
|
-
cfg << (comment xml)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
cfg
|
53
45
|
end
|
54
46
|
|
55
47
|
cfg :ssh do
|
@@ -62,5 +54,48 @@ class ASA < Oxidized::Model
|
|
62
54
|
post_login 'terminal pager 0'
|
63
55
|
pre_logout 'exit'
|
64
56
|
end
|
57
|
+
|
58
|
+
def single_context
|
59
|
+
# Single context mode
|
60
|
+
cmd 'more system:running-config' do |cfg|
|
61
|
+
cfg = cfg.each_line.to_a[3..-1].join
|
62
|
+
cfg.gsub! /^: [^\n]*\n/, ''
|
63
|
+
# backup any xml referenced in the configuration.
|
64
|
+
anyconnect_profiles = cfg.scan(Regexp.new('(\sdisk0:/.+\.xml)')).flatten
|
65
|
+
anyconnect_profiles.each do |profile|
|
66
|
+
cfg << (comment profile + "\n" )
|
67
|
+
cmd ("more" + profile) do |xml|
|
68
|
+
cfg << (comment xml)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
# if DAP is enabled, also backup dap.xml
|
72
|
+
if cfg.rindex(/dynamic-access-policy-record\s(?!DfltAccessPolicy)/)
|
73
|
+
cfg << (comment "disk0:/dap.xml\n")
|
74
|
+
cmd "more disk0:/dap.xml" do |xml|
|
75
|
+
cfg << (comment xml)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
cfg
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def multiple_context
|
83
|
+
# Multiple context mode
|
84
|
+
cmd 'changeto system' do |cfg|
|
85
|
+
cmd 'show running-config' do |systemcfg|
|
86
|
+
allcfg = "\n\n" + systemcfg + "\n\n"
|
87
|
+
contexts = systemcfg.scan(/^context (\S+)$/)
|
88
|
+
files = systemcfg.scan(/config-url (\S+)$/)
|
89
|
+
contexts.each_with_index do |cont, i|
|
90
|
+
allcfg = allcfg + "\n\n----------========== [ CONTEXT " + cont.join(" ") + " FILE " + files[i].join(" ") + " ] ==========----------\n\n"
|
91
|
+
cmd "more " + files[i].join(" ") do |cfgcontext|
|
92
|
+
allcfg = allcfg + "\n\n" + cfgcontext
|
93
|
+
end
|
94
|
+
end
|
95
|
+
cfg = allcfg
|
96
|
+
end
|
97
|
+
cfg
|
98
|
+
end
|
99
|
+
end
|
65
100
|
|
66
101
|
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
class AsyncOS < Oxidized::Model
|
2
|
+
|
3
|
+
# ESA prompt "(mail.example.com)> "
|
4
|
+
prompt /^\r*([(][\w. ]+[)][#>]\s+)$/
|
5
|
+
comment '! '
|
6
|
+
|
7
|
+
# Select passphrase display option
|
8
|
+
expect /\[\S+\]>\s/ do |data, re|
|
9
|
+
send "3\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! /Choose the passphrase option:/, ''
|
28
|
+
cfg.gsub! /1. Mask passphrases \(Files with masked passphrases cannot be loaded using/, ''
|
29
|
+
cfg.gsub! /loadconfig command\)/, ''
|
30
|
+
cfg.gsub! /2. Encrypt passphrases/, ''
|
31
|
+
cfg.gsub! /3. Plain passphrases/, ''
|
32
|
+
cfg.gsub! /^3$/, ''
|
33
|
+
#Delete space
|
34
|
+
cfg.gsub! /\n\s{25,26}/, ''
|
35
|
+
#Delete after line
|
36
|
+
cfg.gsub! /([-\\\/,.\w><@]+)(\s{25,27})/,"\\1"
|
37
|
+
# Add a carriage return
|
38
|
+
cfg.gsub! /([-\\\/,.\w><@]+)(\s{6})([-\\\/,.\w><@]+)/,"\\1\n\\2\\3"
|
39
|
+
# Delete prompt
|
40
|
+
cfg.gsub! /^\r*([(][\w. ]+[)][#>]\s+)$/, ''
|
41
|
+
cfg
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
cfg :ssh do
|
46
|
+
pre_logout "exit"
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
class AudioCodes < Oxidized::Model
|
2
|
+
|
3
|
+
# Pull config from AudioCodes Mediant devices from version > 7.0
|
4
|
+
|
5
|
+
prompt /^\r?([\w.@() -]+[#>]\s?)$/
|
6
|
+
comment '## '
|
7
|
+
|
8
|
+
expect /\s*--MORE--$/ do |data, re|
|
9
|
+
|
10
|
+
send ' '
|
11
|
+
|
12
|
+
data.sub re, ''
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
cmd 'show running-config' do |cfg|
|
17
|
+
cfg
|
18
|
+
end
|
19
|
+
|
20
|
+
cfg :ssh do
|
21
|
+
username /^login as:\s$/
|
22
|
+
password /^.+password:\s$/
|
23
|
+
pre_logout 'exit'
|
24
|
+
end
|
25
|
+
|
26
|
+
cfg :telnet do
|
27
|
+
username /^Username:\s$/
|
28
|
+
password /^Password:\s$/
|
29
|
+
pre_logout 'exit'
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
class Boss < Oxidized::Model
|
2
|
+
# Avaya Baystack Operating System Software(BOSS)
|
3
|
+
# Created by danielcoxman@gmail.com
|
4
|
+
# May 15, 2017
|
5
|
+
# This was tested on ers3510, ers5530, ers4850, ers5952
|
6
|
+
# ssh and telnet were tested with banner and without
|
7
|
+
|
8
|
+
comment '! '
|
9
|
+
|
10
|
+
prompt /^[^\s#>]+[#>]$/
|
11
|
+
|
12
|
+
# Handle the banner
|
13
|
+
# to disable the banner on BOSS the configuration parameter is "banner disabled"
|
14
|
+
expect /Enter Ctrl-Y to begin\./ do |data, re|
|
15
|
+
send "\cY"
|
16
|
+
data.sub re, ''
|
17
|
+
end
|
18
|
+
|
19
|
+
# Handle the Failed retries since last login
|
20
|
+
# no known way to disable other than to implement radius authentication
|
21
|
+
expect /Press ENTER to continue/ do |data, re|
|
22
|
+
send "\n"
|
23
|
+
data.sub re, ''
|
24
|
+
end
|
25
|
+
|
26
|
+
# Handle the menu on the older BOSS example ers55xx, ers56xx
|
27
|
+
# to disable them menu on BOSS the configuration parameter is "cmd-interface cli"
|
28
|
+
expect /ommand Line Interface\.\.\./ do |data, re|
|
29
|
+
send "c"
|
30
|
+
data.sub re, ''
|
31
|
+
end
|
32
|
+
|
33
|
+
# needed for proper formatting
|
34
|
+
cmd('') { |cfg| comment "#{cfg}\n" }
|
35
|
+
|
36
|
+
# Do a sys-info and check and see if it supports stack
|
37
|
+
cmd 'show sys-info' do |cfg|
|
38
|
+
@stack = true if cfg.match /Stack/
|
39
|
+
cfg.gsub! /(^((.*)sysUpTime(.*))$)/, 'removed sysUpTime'
|
40
|
+
cfg.gsub! /(^((.*)sysNtpTime(.*))$)/, 'removed sysNtpTime'
|
41
|
+
cfg.gsub! /(^((.*)sysRtcTime(.*))$)/, 'removed sysNtpTime'
|
42
|
+
# remove timestamp
|
43
|
+
cfg.gsub! /\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} .*/, ''
|
44
|
+
comment "#{cfg}\n"
|
45
|
+
end
|
46
|
+
|
47
|
+
# if a stack then collect the stacking information
|
48
|
+
cmd 'show stack-info' do |cfg|
|
49
|
+
if @stack
|
50
|
+
# remove timestamp
|
51
|
+
cfg.gsub! /\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} .*/, ''
|
52
|
+
comment "#{cfg}\n"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
cmd 'show running-config' do |cfg|
|
57
|
+
cfg.gsub! /^show running-config/, '! show running-config'
|
58
|
+
# remove timestamp
|
59
|
+
cfg.gsub! /\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} .*/, ''
|
60
|
+
cfg.gsub! /^[^\s#>]+[#>]$/, ''
|
61
|
+
cfg.gsub! /^! clock set.*/, '! removed clock set'
|
62
|
+
cfg
|
63
|
+
end
|
64
|
+
|
65
|
+
cfg :telnet do
|
66
|
+
username /Username: /
|
67
|
+
password /Password: /
|
68
|
+
end
|
69
|
+
|
70
|
+
cfg :telnet, :ssh do
|
71
|
+
pre_logout 'logout'
|
72
|
+
post_login 'terminal length 0'
|
73
|
+
post_login 'terminal width 132'
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|