diff options
author | DmitriyEshenko <snooppy@mail.ua> | 2019-08-08 20:53:39 +0000 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2019-12-06 20:42:41 +0100 |
commit | 9e5c463b746cbc9adc74242a07ab3630b89a344e (patch) | |
tree | 85521f3893400d9e8a3c6ccd24d3debc23d3cf5c | |
parent | 2a1e08a617d7d6bbc6aa8c4f53be3412f7e47dfd (diff) | |
download | vyatta-op-9e5c463b746cbc9adc74242a07ab3630b89a344e.tar.gz vyatta-op-9e5c463b746cbc9adc74242a07ab3630b89a344e.zip |
[strip-config] T1568 improved regex for ipv6,mac and full-name
(cherry picked from commit 20822ca355fcec4a364375edf6330e6b2357a570)
-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; |