From 723cb4c8cd9428cc624ed23af43fe2cd518a4c9f Mon Sep 17 00:00:00 2001 From: Alex Harpin Date: Thu, 18 Jun 2015 20:51:21 +0100 Subject: vyatta-op: remove user login public key information with strip-private Extend the strip-private command pipe so that it removes the public key user login information. Bug #567 http://bugzilla.vyos.net/show_bug.cgi?id=567 --- scripts/vyos-strip-config.pl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/vyos-strip-config.pl b/scripts/vyos-strip-config.pl index ad00a5b..2e27d51 100644 --- a/scripts/vyos-strip-config.pl +++ b/scripts/vyos-strip-config.pl @@ -69,6 +69,7 @@ my $stripASN = undef; my $stripLLDP = undef; my $stripSNMP = undef; my $keepPasswords = undef; +my $keepKeys = undef; my $input = undef; GetOptions( @@ -85,7 +86,8 @@ GetOptions( "asn" => \$stripASN, "lldp" => \$stripLLDP, "snmp" => \$stripSNMP, - "keep-passwords" => \$keepPasswords + "keep-passwords" => \$keepPasswords, + "keep-keys" => \$keepKeys ); $strict = 0 if $loose; @@ -127,6 +129,11 @@ if ($stdin) { # Strip passwords $input =~ s/password \S+/password xxxxxx/g if !($keepPasswords); +# Strip public key information +$input =~ s/public-keys \S+/public-keys xxxx\@xxx.xxx/g if !($keepKeys); +$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; -- cgit v1.2.3