From 19546b8b8cc672aa69474ab2c92a9d5714c81a7c Mon Sep 17 00:00:00 2001 From: root Date: Mon, 6 Feb 2017 16:38:08 +0100 Subject: added secret removal for fortiOS --- lib/oxidized/model/fortios.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/oxidized/model/fortios.rb b/lib/oxidized/model/fortios.rb index cd379b7..43374d5 100644 --- a/lib/oxidized/model/fortios.rb +++ b/lib/oxidized/model/fortios.rb @@ -14,6 +14,12 @@ class FortiOS < Oxidized::Model new_cfg << cfg.each_line.to_a[1..-2].map { |line| line.gsub(/(conf_file_ver=)(.*)/, '\1\3') }.join end + cmd :secret do |cfg| + cfg.gsub! /(set password).*/, '\\1 ' + cfg.gsub! /(set passwd).*/, '\\1 ' + cfg + end + cmd 'get system status' do |cfg| @vdom_enabled = cfg.include? 'Virtual domain configuration: enable' cfg.gsub!(/(System time: )(.*)/, '\1\3') -- cgit v1.2.1 From 5d739943be7c696ce88e70b3d137833dc0be5f8c Mon Sep 17 00:00:00 2001 From: root Date: Mon, 6 Feb 2017 16:41:25 +0100 Subject: nicer regex for both password variants of fortiOS --- lib/oxidized/model/fortios.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/oxidized/model/fortios.rb b/lib/oxidized/model/fortios.rb index 43374d5..fa8fd33 100644 --- a/lib/oxidized/model/fortios.rb +++ b/lib/oxidized/model/fortios.rb @@ -15,8 +15,7 @@ class FortiOS < Oxidized::Model end cmd :secret do |cfg| - cfg.gsub! /(set password).*/, '\\1 ' - cfg.gsub! /(set passwd).*/, '\\1 ' + cfg.gsub! /(set (?:passwd|password)).*/, '\\1 ' cfg end -- cgit v1.2.1 From a9587eca976763d82e588a3887805d1cb3e2e27f Mon Sep 17 00:00:00 2001 From: root Date: Mon, 6 Feb 2017 20:20:46 +0100 Subject: changed "diagnose autoupdate version" behaviour, since with every update of signatures the config version is changed --- lib/oxidized/model/fortios.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/oxidized/model/fortios.rb b/lib/oxidized/model/fortios.rb index fa8fd33..cdb50d5 100644 --- a/lib/oxidized/model/fortios.rb +++ b/lib/oxidized/model/fortios.rb @@ -34,7 +34,7 @@ class FortiOS < Oxidized::Model end cfg << cmd('diagnose autoupdate version') do |cfg| - comment cfg + comment cfg.each_line.reject { |line| line.match /Last Update|Result/ }.join end cfg << cmd('end') if @vdom_enabled -- cgit v1.2.1