diff options
author | DmitriyEshenko <snooppy@mail.ua> | 2019-08-08 20:53:39 +0000 |
---|---|---|
committer | DmitriyEshenko <snooppy@mail.ua> | 2019-08-08 20:53:39 +0000 |
commit | 20822ca355fcec4a364375edf6330e6b2357a570 (patch) | |
tree | 021ae97a32d94be8dc2d591198bbb68db039e7b4 | |
parent | b64a8a8c7d865039ec849ee044f7b3b818fdf6b1 (diff) | |
download | vyatta-op-20822ca355fcec4a364375edf6330e6b2357a570.tar.gz vyatta-op-20822ca355fcec4a364375edf6330e6b2357a570.zip |
[strip-config] T1568 improved regex for ipv6,mac and full-name
-rw-r--r-- | scripts/vyos-strip-config.pl | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/scripts/vyos-strip-config.pl b/scripts/vyos-strip-config.pl index b37703f..9903f77 100644 --- a/scripts/vyos-strip-config.pl +++ b/scripts/vyos-strip-config.pl @@ -135,19 +135,22 @@ $input =~ s/(type 'ssh-rsa'|type 'ssh-dss')/type ssh-xxx/g if !($keepKeys); $input =~ s/ key \S+/ key xxxxxx/g if !($keepKeys); # Strip MAC addresses -$input =~ s/([0-9A-F]{2}\:){3}([0-9A-F]{2}((\:{0,1})){3})/XX:XX:XX:$2/gi if $stripMAC; +$input =~ s/([0-9a-fA-F]{2}\:){5}([0-9a-fA-F]{2}((\:{0,1})){3})/XX:XX:XX:XX:XX:$2/gi if $stripMAC; # Strip IPv4 addresses $input =~ s/\d+\.\d+\.(\d+)\.(\d+)/xxx.xxx.$1.$2/g if $stripIP; # Strip IPv6 addresses -$input =~ s/ (([0-9a-f]{1,4}\:){2})(\S+)/ xxxx:xxxx:$3/gi if $stripIP; +$input =~ s/(([0-9a-fA-F]{1,4}\:){2})(\S+)/xxxx:xxxx:$3/gi if $stripIP; # Strip host-name, domain-name, and domain-search $input =~ s/(host-name|domain-name|domain-search) \S+/$1 xxxxxx/g if $stripHostname; # Strip user-names -$input =~ s/(user|username|user-id|full-name) \S+/$1 xxxxxx/g if $stripUsernames; +$input =~ s/(user|username|user-id) \S+/$1 xxxxxx/g if $stripUsernames; + +# Strip full-name +$input =~ s/(full-name) [ -_A-Z a-z]+/$1 xxxxxx/g if $stripUsernames; # Strip DHCP static-mapping and shared network names $input =~ s/(shared-network-name|static-mapping) \S+/$1 xxxxxx/g if $stripDHCP; |