Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions netconan/default_pwd_regexes.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@
)
],
[(r"(?P<prefix>(tacacs|radius)-server (\S+ )*key( \d)? )(\S+)", 5)],
[(r"(?P<prefix>key( \d| hexadecimal)? )(\S+)", 3)],
# Require 3+ chars to avoid false positives on short values like key-chain
# key IDs (e.g. "key 10" in Juniper authentication-key-chains).
[(r"(?P<prefix>key( \d| hexadecimal)? )(\S{3,})", 3)],
[(r"(?P<prefix>ntp authentication-key \d+ md5 )(\S+)", 2)],
[(r"(?P<prefix>syscon( password| address \S+) )(\S+)", 3)],
[
Expand All @@ -114,7 +116,7 @@
[(r"(ldap-login-password) \S+(.*)", None)],
[
(
r"((ikev1 )?(pre-shared-key |key |failover key )(ascii-text |hexadecimal )?).*(.*)",
r"((ikev1 )?(pre-shared-key (ascii-text |hexadecimal )?|key (ascii-text |hexadecimal )|failover key )).*(.*)",
None,
)
],
Expand Down
5 changes: 5 additions & 0 deletions tests/unit/test_sensitive_item_removal.py
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,11 @@ def test_pwd_removal_append(regexes, config_line, sensitive_text, append_text):
"nothing in this string should be replaced",
" interface GigabitEthernet0/0",
"ip address 1.2.3.4 255.255.255.0",
# Key-chain key IDs should not be anonymized (short values, not passwords)
"key 10",
"key 63",
"key-chain kc0 key 0",
"authentication-key-chains key-chain kc0 key 10",
"set community 12345",
"set community 1234:5678",
"set community (1234:5678)",
Expand Down
Loading