mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-22 02:05:41 +01:00
1.Add script to collect logs and configurations 2.Add OVA option to enable/disable root login
This commit is contained in:
parent
592e596ae4
commit
80da0ffea8
21
tools/ova/script/collect.sh
Executable file
21
tools/ova/script/collect.sh
Executable file
@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
dir=harbor_logs
|
||||
mkdir -p $dir
|
||||
|
||||
echo "Version" >> $dir/docker
|
||||
docker version >> $dir/docker
|
||||
printf "\n\nInfo\n" >> $dir/docker
|
||||
docker info >> $dir/docker
|
||||
printf "\n\nImages\n" >> $dir/docker
|
||||
docker images >> $dir/docker
|
||||
printf "\n\nRunning containers\n" >> $dir/docker
|
||||
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 $base_dir/../harbor/harbor.cfg $dir/
|
||||
cp -r /var/log/harbor $dir/
|
||||
tar --remove-files -zcf $dir.tar.gz $dir
|
@ -37,8 +37,8 @@ function gc {
|
||||
#Add rules to iptables
|
||||
function addIptableRules {
|
||||
iptables -A INPUT -p tcp --dport 5480 -j ACCEPT
|
||||
iptables -A INPUT -p tcp --dport 5488 -j ACCEPT
|
||||
iptables -A INPUT -p tcp --dport 5489 -j ACCEPT
|
||||
#iptables -A INPUT -p tcp --dport 5488 -j ACCEPT
|
||||
#iptables -A INPUT -p tcp --dport 5489 -j ACCEPT
|
||||
}
|
||||
|
||||
#Install docker-compose
|
||||
@ -51,4 +51,26 @@ function installDockerCompose {
|
||||
function load {
|
||||
basedir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
docker load -i $basedir/../harbor/harbor*.tgz
|
||||
}
|
||||
|
||||
#Configure SSH
|
||||
function configSSH {
|
||||
value=$(ovfenv -k permit_root_login)
|
||||
if [ "$value" = "true" ]
|
||||
then
|
||||
v=yes
|
||||
else
|
||||
v=no
|
||||
fi
|
||||
echo "ssh: permit root login - $v"
|
||||
sed -i -r s%"^PermitRootLogin .*"%"PermitRootLogin $v"% /etc/ssh/sshd_config
|
||||
|
||||
if [ ! -f /etc/ssh/ssh_host_rsa_key ] \
|
||||
|| [ ! -f /etc/ssh/ssh_host_ecdsa_key ] \
|
||||
|| [ ! -f /etc/ssh/ssh_host_ed25519_key ]
|
||||
then
|
||||
ssh-keygen -A
|
||||
fi
|
||||
|
||||
systemctl restart sshd
|
||||
}
|
@ -16,8 +16,11 @@ then
|
||||
printf "$value\n$value\n" | passwd root
|
||||
fi
|
||||
|
||||
#configure SSH
|
||||
configSSH
|
||||
|
||||
#echo "Adding rules to iptables..."
|
||||
#addIptableRules
|
||||
addIptableRules
|
||||
|
||||
echo "Installing docker compose..."
|
||||
installDockerCompose
|
||||
|
@ -7,8 +7,11 @@ export PATH=$PATH:/usr/local/bin
|
||||
base_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
source $base_dir/common.sh
|
||||
|
||||
#configure SSH
|
||||
configSSH
|
||||
|
||||
#echo "Adding rules to iptables..."
|
||||
#addIptableRules
|
||||
addIptableRules
|
||||
|
||||
#Stop Harbor
|
||||
echo "Shutting down Harbor..."
|
||||
|
Loading…
Reference in New Issue
Block a user