mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-04 15:08:21 +01:00
Merge pull request #1216 from ywk253100/161206_collect_log
Fix exposure issue when collecting logs
This commit is contained in:
commit
9e4c90e406
@ -1,6 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
dir=harbor_logs
|
outputdir=/tmp
|
||||||
|
outputfolder=harbor_logs
|
||||||
|
dir=$outputdir/$outputfolder
|
||||||
mkdir -p $dir
|
mkdir -p $dir
|
||||||
|
|
||||||
echo "Version" >> $dir/docker
|
echo "Version" >> $dir/docker
|
||||||
@ -15,7 +17,29 @@ docker ps >> $dir/docker
|
|||||||
docker-compose version >> $dir/docker-compose
|
docker-compose version >> $dir/docker-compose
|
||||||
|
|
||||||
base_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
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 $base_dir/../harbor/harbor.cfg $dir/
|
||||||
cp -r /var/log/harbor $dir/
|
cp -r /var/log/harbor $dir/
|
||||||
tar --remove-files -zcf $dir.tar.gz $dir
|
|
||||||
|
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."
|
Loading…
Reference in New Issue
Block a user