Skip to content

Commit 71027b8

Browse files
authored
Fix: removing certificates during apache reload (hestiacp#4053)
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. @myvesta
1 parent 220badc commit 71027b8

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

bin/v-change-domain-owner

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,10 @@ if [ -n "$web_data" ]; then
9898
ssl_key=$HESTIA/data/users/$owner/ssl/$domain.key
9999
ssl_ca=$HESTIA/data/users/$owner/ssl/$domain.ca
100100
ssl_pem=$HESTIA/data/users/$owner/ssl/$domain.pem
101-
mv $ssl_crt $HESTIA/data/users/$user/ssl/
102-
mv $ssl_key $HESTIA/data/users/$user/ssl/
103-
mv $ssl_ca $HESTIA/data/users/$user/ssl/ >> /dev/null 2>&1
104-
mv $ssl_pem $HESTIA/data/users/$user/ssl/ >> /dev/null 2>&1
105-
rm -f $HOMEDIR/$owner/conf/web/ssl.$domain.*
101+
cp $ssl_crt $HESTIA/data/users/$user/ssl/
102+
cp $ssl_key $HESTIA/data/users/$user/ssl/
103+
cp $ssl_ca $HESTIA/data/users/$user/ssl/ >> /dev/null 2>&1
104+
cp $ssl_pem $HESTIA/data/users/$user/ssl/ >> /dev/null 2>&1
106105
fi
107106

108107
# Check ftp user account
@@ -124,6 +123,15 @@ if [ -n "$web_data" ]; then
124123
find "$HOMEDIR/$user/web/$domain" -user "$owner" \
125124
-exec chown -h $user:$user {} \;
126125

126+
if [ "$SSL" = 'yes' ]; then
127+
sleep 10
128+
rm $ssl_crt
129+
rm $ssl_key
130+
rm $ssl_ca > /dev/null 2>&1
131+
rm $ssl_pem > /dev/null 2>&1
132+
rm -f $HOMEDIR/$owner/conf/web/ssl.$domain.*
133+
fi
134+
127135
# Rebuild config
128136
$BIN/v-unsuspend-web-domain "$user" "$domain" no >> /dev/null 2>&1
129137
$BIN/v-rebuild-web-domains "$owner" no

0 commit comments

Comments
 (0)