summaryrefslogtreecommitdiff
path: root/lib/oxidized/model/fortios.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/oxidized/model/fortios.rb')
-rw-r--r--lib/oxidized/model/fortios.rb33
1 files changed, 15 insertions, 18 deletions
diff --git a/lib/oxidized/model/fortios.rb b/lib/oxidized/model/fortios.rb
index bffaf3c..bbbab89 100644
--- a/lib/oxidized/model/fortios.rb
+++ b/lib/oxidized/model/fortios.rb
@@ -1,6 +1,5 @@
class FortiOS < Oxidized::Model
-
- comment '# '
+ comment '# '
prompt /^([-\w\.\~]+(\s[\(\w\-\.\)]+)?\~?\s?[#>$]\s?)$/
@@ -15,10 +14,10 @@ class FortiOS < Oxidized::Model
end
cmd :secret do |cfg|
- cfg.gsub! /(set (?:passwd|password|psksecret|secret|key|group-password|secondary-secret|tertiary-secret|auth-password-l1|auth-password-l2|rsso|history0|history1|inter-controller-key ENC)).*/, '\\1 <configuration removed>'
- cfg.gsub! /(set private-key).*-+END ENCRYPTED PRIVATE KEY-*"$/m , '\\1 <configuration removed>'
- cfg.gsub! /(set ca ).*-+END CERTIFICATE-*"$/m , '\\1 <configuration removed>'
- cfg.gsub! /(set csr ).*-+END CERTIFICATE REQUEST-*"$/m , '\\1 <configuration removed>'
+ cfg.gsub! /(set (?:passwd|password|psksecret|secret|key|group-password|secondary-secret|tertiary-secret|auth-password-l1|auth-password-l2|rsso|history0|history1|inter-controller-key ENC|passphrase ENC|login-passwd ENC)).*/, '\\1 <configuration removed>'
+ cfg.gsub! /(set private-key).*-+END ENCRYPTED PRIVATE KEY-*"$/m, '\\1 <configuration removed>'
+ cfg.gsub! /(set ca ).*-+END CERTIFICATE-*"$/m, '\\1 <configuration removed>'
+ cfg.gsub! /(set csr ).*-+END CERTIFICATE REQUEST-*"$/m, '\\1 <configuration removed>'
cfg.gsub! /(Virus-DB|Extended DB|IPS-DB|IPS-ETDB|APP-DB|INDUSTRIAL-DB|Botnet DB|IPS Malicious URL Database).*/, '\\1 <configuration removed>'
cfg.gsub! /(Cluster uptime:).*/, '\\1 <configuration removed>'
cfg
@@ -35,21 +34,21 @@ class FortiOS < Oxidized::Model
cfg << cmd('config global') if @vdom_enabled
cfg << cmd('get hardware status') do |cfg|
- comment cfg
+ comment cfg
end
- #default behaviour: include autoupdate output (backwards compatibility)
- #do not include if variable "show_autoupdate" is set to false
- if defined?(vars(:fortios_autoupdate)).nil? || vars(:fortios_autoupdate)
- cfg << cmd('diagnose autoupdate version') do |cfg|
- cfg.gsub! /(FDS Address\n---------\n).*/, '\\1IP Address removed'
- comment cfg.each_line.reject { |line| line.match /Last Update|Result/ }.join
- end
+ # default behaviour: include autoupdate output (backwards compatibility)
+ # do not include if variable "show_autoupdate" is set to false
+ if defined?(vars(:fortios_autoupdate)).nil? || vars(:fortios_autoupdate)
+ cfg << cmd('diagnose autoupdate version') do |cfg|
+ cfg.gsub! /(FDS Address\n---------\n).*/, '\\1IP Address removed'
+ comment cfg.each_line.reject { |line| line.match /Last Update|Result/ }.join
+ end
end
-cfg << cmd('end') if @vdom_enabled
+ cfg << cmd('end') if @vdom_enabled
- cfg << cmd('show full-configuration')
+ cfg << cmd('show full-configuration | grep .')
cfg.join "\n"
end
@@ -61,6 +60,4 @@ cfg << cmd('end') if @vdom_enabled
cfg :telnet, :ssh do
pre_logout "exit\n"
end
-
end
-