summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md3
-rw-r--r--README.md8
-rwxr-xr-xbin/oxidized3
-rw-r--r--lib/oxidized.rb2
-rw-r--r--lib/oxidized/input/cli.rb3
-rw-r--r--lib/oxidized/model/asa.rb3
-rw-r--r--lib/oxidized/model/cumulus.rb14
-rw-r--r--lib/oxidized/model/datacom.rb7
-rw-r--r--lib/oxidized/model/pfsense.rb27
-rw-r--r--lib/oxidized/model/saos.rb6
-rw-r--r--lib/oxidized/model/timos.rb71
11 files changed, 129 insertions, 18 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c193dd5..c482508 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,6 @@
+# 0.16.3
+- BUGFIX: cumulus prompt not working with default switch configs (by @nertwork)
+
# 0.16.2
- BUGFIX: when not using git (by @danilopopeye)
- BUGFIX: screenos update
diff --git a/README.md b/README.md
index 6a088c6..90fd7f8 100644
--- a/README.md
+++ b/README.md
@@ -50,7 +50,6 @@ Oxidized is a network device configuration backup tool. It's a RANCID replacemen
* AOS
* AOS7
* ISAM
- * TiMOS
* Wireless
* Arista
* EOS
@@ -118,10 +117,13 @@ Oxidized is a network device configuration backup tool. It's a RANCID replacemen
* MasterOS
* Netonix
* WISP Switch (As Netonix)
+ * Nokia (formerly TiMetra, Alcatel, Alcatel-Lucent)
+ * SR OS (TiMOS)
* Opengear
* Opengear
* Palo Alto
* PANOS
+ * pfSense
* Quanta
* Quanta / VxWorks 6.6 (1.1.0.8)
* Supermicro
@@ -420,6 +422,8 @@ source:
url: https://url/api
scheme: https
delimiter: !ruby/regexp /:/
+ user: username
+ pass: password
map:
name: hostname
model: os
@@ -510,7 +514,7 @@ output:
### Output types
-If you prefer to have different outputs in different files and/or directories, you can easily do this by modifying the corresponding model. To change the behaviour for IOS, you would edit `lib/oxidized/model/ios.rb`.
+If you prefer to have different outputs in different files and/or directories, you can easily do this by modifying the corresponding model. To change the behaviour for IOS, you would edit `lib/oxidized/model/ios.rb` (run `gem contents oxidized` to find out the full file path).
For example, let's say you want to split out `show version` and `show inventory` into separate files in a directory called `nodiff` which your tools will not send automated diffstats for. You can apply a patch along the lines of
diff --git a/bin/oxidized b/bin/oxidized
index 2695a52..7a0b03d 100755
--- a/bin/oxidized
+++ b/bin/oxidized
@@ -9,5 +9,6 @@ begin
Oxidized::CLI.new.run
rescue => error
warn "#{error}"
- raise if Oxidized.config.debug
+ debug = Oxidied.config.debug rescue true
+ raise if debug
end
diff --git a/lib/oxidized.rb b/lib/oxidized.rb
index f40daf9..ce48f10 100644
--- a/lib/oxidized.rb
+++ b/lib/oxidized.rb
@@ -43,7 +43,7 @@ module Oxidized
else
require 'logger'
if config.has_key?('log')
- Logger.new(config.log)
+ Logger.new(File.expand_path(config.log))
else
Logger.new(STDERR)
end
diff --git a/lib/oxidized/input/cli.rb b/lib/oxidized/input/cli.rb
index fc7f426..660e173 100644
--- a/lib/oxidized/input/cli.rb
+++ b/lib/oxidized/input/cli.rb
@@ -14,6 +14,9 @@ module Oxidized
d = node.model.get
disconnect
d
+ rescue PromptUndetect
+ disconnect
+ raise
end
def connect_cli
diff --git a/lib/oxidized/model/asa.rb b/lib/oxidized/model/asa.rb
index 1e45a91..a41348e 100644
--- a/lib/oxidized/model/asa.rb
+++ b/lib/oxidized/model/asa.rb
@@ -13,6 +13,9 @@ class ASA < Oxidized::Model
cmd :secret do |cfg|
cfg.gsub! /enable password (\S+) (.*)/, 'enable password <secret hidden> \2'
cfg.gsub! /username (\S+) password (\S+) (.*)/, 'username \1 password <secret hidden> \3'
+ cfg.gsub! /ikev2 pre-shared-key (\S+)/, 'ikev2 pre-shared-key <secret hidden>'
+ cfg.gsub! /ikev2 (remote|local)-authentication pre-shared-key (\S+)/, 'ikev2 \1-authentication pre-shared-key <secret hidden>'
+ cfg.gsub! /^(aaa-server TACACS\+ \(\S+\) host.*\n\skey) \S+$/m, '\1 <secret hidden>'
cfg
end
diff --git a/lib/oxidized/model/cumulus.rb b/lib/oxidized/model/cumulus.rb
index 68d856e..dc6792a 100644
--- a/lib/oxidized/model/cumulus.rb
+++ b/lib/oxidized/model/cumulus.rb
@@ -1,6 +1,6 @@
class Cumulus < Oxidized::Model
- prompt /^((\w*)@(.*)([>#]\s)+)$/
+ prompt /^((\w*)@(.*)):/
comment '# '
@@ -22,7 +22,7 @@ class Cumulus < Oxidized::Model
cfg += cmd 'cat /etc/hosts'
cfg += add_comment 'THE INTERFACES'
- cfg += cmd 'cat /etc/network/interfaces'
+ cfg += cmd 'grep -r "" /etc/network/interface* | cut -d "/" -f 4-'
cfg += add_comment 'RESOLV.CONF'
cfg += cmd 'cat /etc/resolv.conf'
@@ -30,6 +30,9 @@ class Cumulus < Oxidized::Model
cfg += add_comment 'NTP.CONF'
cfg += cmd 'cat /etc/ntp.conf'
+ cfg += add_comment 'IP Routes'
+ cfg += cmd 'netstat -rn'
+
cfg += add_comment 'QUAGGA DAEMONS'
cfg += cmd 'cat /etc/quagga/daemons'
@@ -55,10 +58,13 @@ class Cumulus < Oxidized::Model
cfg += cmd 'cat /etc/cumulus/switchd.conf'
cfg += add_comment 'ACL'
- cfg += cmd 'iptables -L'
+ cfg += cmd 'iptables -L -n'
cfg += add_comment 'VERSION'
cfg += cmd 'cat /etc/cumulus/etc.replace/os-release'
+
+ cfg += add_comment 'License'
+ cfg += cmd 'cl-license'
end
@@ -73,4 +79,4 @@ class Cumulus < Oxidized::Model
end
-end \ No newline at end of file
+end
diff --git a/lib/oxidized/model/datacom.rb b/lib/oxidized/model/datacom.rb
index 54091ed..5dbc080 100644
--- a/lib/oxidized/model/datacom.rb
+++ b/lib/oxidized/model/datacom.rb
@@ -24,7 +24,12 @@ class DataCom < Oxidized::Model
cfg.cut_head
end
- cfg :telnet, :ssh do
+ cfg :ssh do
+ password /^Password:\s$/
+ pre_logout 'exit'
+ end
+
+ cfg :telnet do
username /login:\s$/
password /^Password:\s$/
pre_logout 'exit'
diff --git a/lib/oxidized/model/pfsense.rb b/lib/oxidized/model/pfsense.rb
new file mode 100644
index 0000000..8cb0118
--- /dev/null
+++ b/lib/oxidized/model/pfsense.rb
@@ -0,0 +1,27 @@
+class PfSense < Oxidized::Model
+
+ # use other use than 'admin' user, 'admin' user cannot get ssh/exec. See issue #535
+
+ comment '# '
+
+ #add a comment in the final conf
+ def add_comment comment
+ "\n###### #{comment} ######\n"
+ end
+
+ cmd :all do |cfg|
+ cfg.each_line.to_a[1..-2].join
+ end
+
+ #show the persistent configuration
+ pre do
+ cfg = add_comment 'Configuration'
+ cfg += cmd 'cat /cf/conf/config.xml'
+ end
+
+ cfg :ssh do
+ exec true
+ pre_logout 'exit'
+ end
+
+end
diff --git a/lib/oxidized/model/saos.rb b/lib/oxidized/model/saos.rb
index cada35b..5d460cf 100644
--- a/lib/oxidized/model/saos.rb
+++ b/lib/oxidized/model/saos.rb
@@ -17,8 +17,10 @@ class SAOS < Oxidized::Model
username /login:/
password /assword:/
end
- cfg :telnet do
+
+ cfg :telnet, :ssh do
+ post_login 'system shell set more off'
post_login 'system shell session set more off'
pre_logout 'exit'
end
-end \ No newline at end of file
+end
diff --git a/lib/oxidized/model/timos.rb b/lib/oxidized/model/timos.rb
index dc28580..d40e845 100644
--- a/lib/oxidized/model/timos.rb
+++ b/lib/oxidized/model/timos.rb
@@ -1,8 +1,10 @@
class TiMOS < Oxidized::Model
- # Alcatel-Lucent TiMOS (Timetra)
- # used in SR/ESS/SAS routers
-
+ #
+ # Nokia SR OS (TiMOS) (formerly TiMetra, Alcatel, Alcatel-Lucent).
+ # Used in 7705 SAR, 7210 SAS, 7450 ESS, 7750 SR, 7950 XRS, and NSP.
+ #
+
comment '# '
prompt /^([-\w\.:>\*]+\s?[#>]\s?)$/
@@ -12,26 +14,81 @@ class TiMOS < Oxidized::Model
new_cfg << cfg.each_line.to_a[1..-2].join
end
+ #
+ # Show the boot options file.
+ #
cmd 'show bof' do |cfg|
comment cfg
end
+ #
+ # Show the system information.
+ #
cmd 'show system information' do |cfg|
- # strip uptime
+ #
+ # Strip uptime.
+ #
cfg.sub! /^System Up Time.*\n/, ''
comment cfg
end
+ #
+ # Show the card state.
+ #
cmd 'show card state' do |cfg|
comment cfg
end
- cmd 'show boot-messages' do |cfg|
- cfg.gsub! /\r/, ""
+ #
+ # Show the boot log.
+ #
+ cmd 'file type bootlog.txt' do |cfg|
+ #
+ # Strip carriage returns and backspaces.
+ #
+ cfg.gsub! /\r/, ''
+ cfg.gsub! /[\b][\b][\b]/, "\n"
+ comment cfg
+ end
+
+ #
+ # Show the running debug configuration.
+ #
+ cmd 'show debug' do |cfg|
comment cfg
end
- cmd 'admin display-config'
+ #
+ # Show the saved debug configuration (admin debug-save).
+ #
+ cmd 'file type config.dbg' do |cfg|
+ #
+ # Strip carriage returns.
+ #
+ cfg.gsub! /\r/, ''
+ comment cfg
+ end
+
+ #
+ # Show the running persistent indices.
+ #
+ cmd 'admin display-config index' do |cfg|
+ #
+ # Strip carriage returns.
+ #
+ cfg.gsub! /\r/, ''
+ comment cfg
+ end
+
+ #
+ # Show the running configuration.
+ #
+ cmd 'admin display-config' do |cfg|
+ #
+ # Strip carriage returns.
+ #
+ cfg.gsub! /\r/, ''
+ end
cfg :telnet do
username /^Login: /