From a4acb57e54edae1c094104971be1da0342f1268a Mon Sep 17 00:00:00 2001 From: myvesta <38690722+myvesta@users.noreply.github.com> Date: Sun, 8 Oct 2023 16:28:08 +0200 Subject: [PATCH] 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. --- bin/v-change-domain-owner | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/bin/v-change-domain-owner b/bin/v-change-domain-owner index c3f8bcfa3..09ae9bcc3 100755 --- a/bin/v-change-domain-owner +++ b/bin/v-change-domain-owner @@ -60,11 +60,11 @@ if [ ! -z "$web_data" ]; then ssl_key=$VESTA/data/users/$owner/ssl/$domain.key ssl_ca=$VESTA/data/users/$owner/ssl/$domain.ca ssl_pem=$VESTA/data/users/$owner/ssl/$domain.pem - mv $ssl_crt $VESTA/data/users/$user/ssl/ - mv $ssl_key $VESTA/data/users/$user/ssl/ - mv $ssl_ca $VESTA/data/users/$user/ssl/ >> /dev/null 2>&1 - mv $ssl_pem $VESTA/data/users/$user/ssl/ >> /dev/null 2>&1 - rm -f $HOMEDIR/$owner/conf/web/ssl.$domain.* + cp $ssl_crt $VESTA/data/users/$user/ssl/ + cp $ssl_key $VESTA/data/users/$user/ssl/ + cp $ssl_ca $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.* fi # Check ftp user account @@ -86,6 +86,15 @@ if [ ! -z "$web_data" ]; then find $HOMEDIR/$user/web/$domain -user $owner \ -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 $BIN/v-unsuspend-web-domain $user $domain no >> /dev/null 2>&1 $BIN/v-rebuild-web-domains $owner no