Skip to content

Commit

Permalink
Add secrets masking to DlinkNextGen (#3084)
Browse files Browse the repository at this point in the history
Co-authored-by: Tristan Crichton <[email protected]>
  • Loading branch information
tcrichton and Tristan Crichton authored Feb 27, 2024
1 parent ae5499c commit a46c67b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
- zynos: Rewrite the script to properly collect config via ssh/telnet. Backup with FTP is not working atm, feel free to open an issue if needed. (@sharteeya)
- pfsense: exclude autogenerated firewall rule timestamps to reduce change churn from use of stuff like PFBlockerNG #2985 (@anthonysomerset)
- ciscosmb: ignore "Please change the password" hint when doing backup. (@sharteeya)
- dlinknextgen removes user and snmp-server secrets (@tcrichton)


## Fixed
- fixed empty lines for ZyXEL GS1900 switches (@jluebbe)
Expand Down
12 changes: 12 additions & 0 deletions lib/oxidized/model/dlinknextgen.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,23 @@ class DlinkNextGen < Oxidized::Model
cfg.each_line.to_a[2..-2].map { |line| line.delete("\r").rstrip }.join("\n") + "\n"
end

cmd :secret do |cfg|
cfg.gsub! /(password) (\S+).*/, '\\1 <secret hidden>'
cfg.gsub! /(snmp-server group) (\S+) (v.*)/, '\\1 <secret hidden> \\3'
cfg.gsub! /(snmp-server community) (\S+) (v.*)/, '\\1 <secret hidden> \\3'
cfg
end

# "show switch" doesn't exist on DXS-1210-28T rev A1 Firmware: Build 1.00.024; not figured out how to run "show version" so running both
cmd 'show switch' do |cfg|
cfg.gsub! /^\s+System Time\s.+/, '' # Omit constantly changing uptime info
comment cfg
end

cmd 'show version' do |cfg|
comment cfg
end

cmd 'show vlan' do |cfg|
comment cfg
end
Expand Down

0 comments on commit a46c67b

Please sign in to comment.