From c89503a8b2c53d9ee2a1fc8020ecc5fba600a891 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 16 Feb 2017 09:08:08 +0100 Subject: added psk and private-key removal to secret section --- lib/oxidized/model/fortios.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/oxidized/model/fortios.rb b/lib/oxidized/model/fortios.rb index cdb50d5..3cfd102 100644 --- a/lib/oxidized/model/fortios.rb +++ b/lib/oxidized/model/fortios.rb @@ -15,7 +15,8 @@ class FortiOS < Oxidized::Model end cmd :secret do |cfg| - cfg.gsub! /(set (?:passwd|password)).*/, '\\1 ' + cfg.gsub! /(set (?:passwd|password|psksecret)).*/, '\\1 ' + cfg.gsub! /(set private-key).*-+END ENCRYPTED PRIVATE KEY-*"$/m , '\\1 ' cfg end -- cgit v1.2.1 From 261e6d41f1daa6f37c2a0c5e3b059cbfd77dc895 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 16 Feb 2017 14:28:59 +0100 Subject: added variable fortios_autoupdate, to control inclusion of autoupdate messages --- lib/oxidized/model/fortios.rb | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/oxidized/model/fortios.rb b/lib/oxidized/model/fortios.rb index 3cfd102..2415537 100644 --- a/lib/oxidized/model/fortios.rb +++ b/lib/oxidized/model/fortios.rb @@ -31,14 +31,18 @@ class FortiOS < Oxidized::Model cfg << cmd('config global') if @vdom_enabled cfg << cmd('get hardware status') do |cfg| - comment cfg + comment cfg end - cfg << cmd('diagnose autoupdate version') do |cfg| - comment cfg.each_line.reject { |line| line.match /Last Update|Result/ }.join + #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| + 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') cfg.join "\n" @@ -54,3 +58,4 @@ class FortiOS < Oxidized::Model end end + -- cgit v1.2.1