Fixing removing certificates during apache reload

v-suspend-web-domain on line 49 is triggering apache/nginx reload... that is doing it in the background... and on line 64, we were previously doing 'mv' for certificates... 
If the reload lasts too long it in the background, certificates will vanish because of 'mv' on line 64.
This fix will avoid this collision by doing 'cp' instead of 'mv', then sleeping for 10 sec, and then removing certificates.
We will call this bug "Nemanja Puhalo's bug" because he hit this bug first.
This commit is contained in:
myvesta 2023-10-08 16:28:08 +02:00 committed by GitHub
commit a4acb57e54
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -60,11 +60,11 @@ if [ ! -z "$web_data" ]; then
ssl_key=$VESTA/data/users/$owner/ssl/$domain.key ssl_key=$VESTA/data/users/$owner/ssl/$domain.key
ssl_ca=$VESTA/data/users/$owner/ssl/$domain.ca ssl_ca=$VESTA/data/users/$owner/ssl/$domain.ca
ssl_pem=$VESTA/data/users/$owner/ssl/$domain.pem ssl_pem=$VESTA/data/users/$owner/ssl/$domain.pem
mv $ssl_crt $VESTA/data/users/$user/ssl/ cp $ssl_crt $VESTA/data/users/$user/ssl/
mv $ssl_key $VESTA/data/users/$user/ssl/ cp $ssl_key $VESTA/data/users/$user/ssl/
mv $ssl_ca $VESTA/data/users/$user/ssl/ >> /dev/null 2>&1 cp $ssl_ca $VESTA/data/users/$user/ssl/ > /dev/null 2>&1
mv $ssl_pem $VESTA/data/users/$user/ssl/ >> /dev/null 2>&1 cp $ssl_pem $VESTA/data/users/$user/ssl/ > /dev/null 2>&1
rm -f $HOMEDIR/$owner/conf/web/ssl.$domain.* # rm -f $HOMEDIR/$owner/conf/web/ssl.$domain.*
fi fi
# Check ftp user account # Check ftp user account
@ -86,6 +86,15 @@ if [ ! -z "$web_data" ]; then
find $HOMEDIR/$user/web/$domain -user $owner \ find $HOMEDIR/$user/web/$domain -user $owner \
-exec chown -h $user:$user {} \; -exec chown -h $user:$user {} \;
if [ "$SSL" = 'yes' ]; then
sleep 10
rm $ssl_crt
rm $ssl_key
rm $ssl_ca > /dev/null 2>&1
rm $ssl_pem > /dev/null 2>&1
rm -f $HOMEDIR/$owner/conf/web/ssl.$domain.*
fi
# Rebuild config # Rebuild config
$BIN/v-unsuspend-web-domain $user $domain no >> /dev/null 2>&1 $BIN/v-unsuspend-web-domain $user $domain no >> /dev/null 2>&1
$BIN/v-rebuild-web-domains $owner no $BIN/v-rebuild-web-domains $owner no