Skip to content

Commit

Permalink
Merge pull request #3007 from codejake/patch-1
Browse files Browse the repository at this point in the history
Update fortios.rb to remove additional secrets
  • Loading branch information
robertcheramy authored Jan 15, 2024
2 parents b1a36b4 + cecbd34 commit da7e742
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/oxidized/model/fortios.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class FortiOS < Oxidized::Model
cfg.gsub! /(set (?:passwd|password|key|group-password|auth-password-l1|auth-password-l2|rsso|history0|history1)) .+/, '\\1 <configuration removed>'
cfg.gsub! /(set md5-key [0-9]+) .+/, '\\1 <configuration removed>'
cfg.gsub! /(set private-key ).*?-+END (ENCRYPTED|RSA|OPENSSH) PRIVATE KEY-+\n?"$/m, '\\1<configuration removed>'
cfg.gsub! /(set privatekey ).*?-+END (ENCRYPTED|RSA|OPENSSH) PRIVATE KEY-+\n?"$/m, '\\1<configuration removed>'
cfg.gsub! /(set ca )"-+BEGIN.*?-+END CERTIFICATE-+"$/m, '\\1<configuration removed>'
cfg.gsub! /(set csr ).*?-+END CERTIFICATE REQUEST-+"$/m, '\\1<configuration removed>'
cfg
Expand Down

2 comments on commit da7e742

@TafkaMax
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this commit! I was just about to create a pull request myself aswell!.

I think I will create one though. As there is also 'set certificate' option in my FortiOS conf.

@TafkaMax
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also for me, the regex does not seem to work for multiline strings. For example all of my multiline entries are still present. But things like password, which are not multiline are removed.

Please sign in to comment.