diff options
author | Samer Abdel-Hafez <sam@arahant.net> | 2014-06-11 09:31:25 +0200 |
---|---|---|
committer | Samer Abdel-Hafez <sam@arahant.net> | 2014-06-11 09:31:25 +0200 |
commit | c19cc681e14977bf741359346fe18b8da5c51355 (patch) | |
tree | 0c270490e08586807fb95321bbef1b8c55f885a4 | |
parent | b893ec78e10de9d29fcfc62e1cf67d6a72c7dfd0 (diff) |
add secrets removal code + bump version
-rw-r--r-- | lib/oxidized/model/eos.rb | 6 | ||||
-rw-r--r-- | lib/oxidized/model/ios.rb | 6 | ||||
-rw-r--r-- | lib/oxidized/model/iosxr.rb | 6 | ||||
-rw-r--r-- | lib/oxidized/model/junos.rb | 6 | ||||
-rw-r--r-- | oxidized.gemspec | 2 |
5 files changed, 25 insertions, 1 deletions
diff --git a/lib/oxidized/model/eos.rb b/lib/oxidized/model/eos.rb index e08598b..46f44a2 100644 --- a/lib/oxidized/model/eos.rb +++ b/lib/oxidized/model/eos.rb @@ -11,6 +11,12 @@ class EOS < Oxidized::Model cfg.each_line.to_a[2..-2].join end + cmd :secret do |cfg| + cfg.gsub! /^(snmp-server community).*/, '\\1 <configuration removed>' + cfg.gsub! /username (\S+) privilege (\d+) (\S+).*/, '<secret hidden>' + cfg + end + cmd 'show inventory | no-more' do |cfg| comment cfg end diff --git a/lib/oxidized/model/ios.rb b/lib/oxidized/model/ios.rb index e557469..a9c2d3b 100644 --- a/lib/oxidized/model/ios.rb +++ b/lib/oxidized/model/ios.rb @@ -22,6 +22,12 @@ class IOS < Oxidized::Model cfg.each_line.to_a[1..-2].join end + cmd :secret do |cfg| + cfg.gsub! /^(snmp-server community).*/, '\\1 <configuration removed>' + cfg.gsub! /username (\S+) privilege (\d+) (\S+).*/, '<secret hidden>' + cfg + end + cmd 'show inventory' do |cfg| comment cfg end diff --git a/lib/oxidized/model/iosxr.rb b/lib/oxidized/model/iosxr.rb index 1129a0c..25c1318 100644 --- a/lib/oxidized/model/iosxr.rb +++ b/lib/oxidized/model/iosxr.rb @@ -8,6 +8,12 @@ class IOSXR < Oxidized::Model cfg.each_line.to_a[2..-2].join end + cmd :secret do |cfg| + cfg.gsub! /^(snmp-server community).*/, '\\1 <configuration removed>' + cfg.gsub! /secret (\d+) (\S+).*/, '<secret hidden>' + cfg + end + cmd 'show inventory' do |cfg| comment cfg end diff --git a/lib/oxidized/model/junos.rb b/lib/oxidized/model/junos.rb index 5b3d11b..06d627f 100644 --- a/lib/oxidized/model/junos.rb +++ b/lib/oxidized/model/junos.rb @@ -12,6 +12,12 @@ class JunOS < Oxidized::Model cfg end + cmd :secret do |cfg| + cfg.gsub! /encrypted-password (\S+).*/, '<secret removed>' + cfg.gsub! /community (\S+) {/, 'community <hidden> {' + cfg + end + cmd 'show configuration' cmd 'show version' do |cfg| diff --git a/oxidized.gemspec b/oxidized.gemspec index 86ef906..8e1ea22 100644 --- a/oxidized.gemspec +++ b/oxidized.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'oxidized' - s.version = '0.0.58' + s.version = '0.0.59' s.platform = Gem::Platform::RUBY s.authors = [ 'Saku Ytti' ] s.email = %w( saku@ytti.fi ) |