From bad8835c791bccf971bf4907130d699428768a17 Mon Sep 17 00:00:00 2001 From: Wenkai Yin Date: Tue, 6 Dec 2016 13:05:57 +0800 Subject: [PATCH] fix exposure issue when collecting logs --- tools/ova/script/collect.sh | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/tools/ova/script/collect.sh b/tools/ova/script/collect.sh index a189a6f8a..a1f44b6c8 100755 --- a/tools/ova/script/collect.sh +++ b/tools/ova/script/collect.sh @@ -1,6 +1,8 @@ #!/bin/bash -dir=harbor_logs +outputdir=/tmp +outputfolder=harbor_logs +dir=$outputdir/$outputfolder mkdir -p $dir echo "Version" >> $dir/docker @@ -15,7 +17,29 @@ docker ps >> $dir/docker docker-compose version >> $dir/docker-compose base_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -cp -r $base_dir/../harbor/common $dir/ +cp -r $base_dir/../script $dir/ cp $base_dir/../harbor/harbor.cfg $dir/ cp -r /var/log/harbor $dir/ -tar --remove-files -zcf $dir.tar.gz $dir \ No newline at end of file + +properties=( + email_server + email_server_port + email_username + email_password + email_from + harbor_admin_password + ldap_url + ldap_searchdn + ldap_search_pwd + ldap_basedn + db_password + ) + +for property in "${properties[@]}" +do + sed -i -r "s%#?$property\s*=\s*.*%$property = %" $dir/harbor.cfg +done + +tar --remove-files -zcf $outputfolder.tar.gz -C $outputdir $outputfolder + +echo "$outputfolder.tar.gz is generated in current directory." \ No newline at end of file