Skip to content

Commit

Permalink
[generate_dump] Fix for deletion flow for all secret files from show-…
Browse files Browse the repository at this point in the history
…techsupport dump (sonic-net#2571)

- What I did
Fixed a deletion flow for all secret files in the tech support dump.

- How I did it
Delete files by using the find and rm Linux utilities.

- How to verify it
Run the show_techsupport/test_techsupport_no_secret.py

Signed-off-by: Vadym Hlushko <vadymh@nvidia.com>
  • Loading branch information
vadymhlushko-mlnx authored Jan 3, 2023
1 parent fd4d9c0 commit b34a540
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions scripts/generate_dump
Original file line number Diff line number Diff line change
Expand Up @@ -1697,10 +1697,14 @@ main() {
# Remove unecessary files
$RM $V -rf $TARDIR/etc/alternatives $TARDIR/etc/passwd* \
$TARDIR/etc/shadow* $TARDIR/etc/group* $TARDIR/etc/gshadow* \
$TARDIR/etc/ssh* $TARDIR/get_creds* $TARDIR/snmpd.conf* \
$TARDIR/etc/mlnx $TARDIR/etc/mft $TARDIR/etc/sonic/*.cer \
$TARDIR/etc/sonic/*.crt $TARDIR/etc/sonic/*.pem $TARDIR/etc/sonic/*.key \
$TARDIR/etc/ssl/*.pem $TARDIR/etc/ssl/certs/ $TARDIR/etc/ssl/private/*
$TARDIR/etc/ssh* $TARDIR/etc/mlnx $TARDIR/etc/mft \
$TARDIR/etc/ssl/certs/ $TARDIR/etc/ssl/private/*
rm_list=$(find -L $TARDIR -type f \( -iname \*.cer -o -iname \*.crt -o \
-iname \*.pem -o -iname \*.key -o -iname \*snmpd.conf\* -o -iname \*get_creds\* \))
if [ ! -z "$rm_list" ]
then
rm $rm_list
fi

save_log_files &
save_crash_files &
Expand Down

0 comments on commit b34a540

Please sign in to comment.