From b34a540cca5555ab3aa74e19e81f24c2a20d311b Mon Sep 17 00:00:00 2001 From: Vadym Hlushko <62022266+vadymhlushko-mlnx@users.noreply.github.com> Date: Tue, 3 Jan 2023 11:21:52 +0200 Subject: [PATCH] [generate_dump] Fix for deletion flow for all secret files from show-techsupport dump (#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 --- scripts/generate_dump | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/generate_dump b/scripts/generate_dump index ddb2727efd..00b71eb76e 100755 --- a/scripts/generate_dump +++ b/scripts/generate_dump @@ -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 &