Преглед изворни кода

Fix: Restoring SSL enabled web domain from a Hestia archive would fail when the target user was already present

- Restoring from Vesta archives was not affected

Fix #834
Robert Zollner пре 5 година
родитељ
комит
bca6e2905d
1 измењених фајлова са 13 додато и 6 уклоњено
  1. 13 6
      bin/v-restore-user

+ 13 - 6
bin/v-restore-user

@@ -375,12 +375,19 @@ if [ "$web" != 'no' ] && [ ! -z "$WEB_SYSTEM" ]; then
 
             # Copying SSL certificates
             if [ "$SSL" = 'yes' ]; then
-                certificates=$(ls $tmpdir/web/$domain/conf| grep ssl)
-                certificates=$(echo "$certificates" |grep $domain)
-                for crt in $certificates; do
-                    crt=$(echo $crt|sed -e "s/ssl.//")
-                    cp -f $tmpdir/web/$domain/conf/ssl.$crt $USER_DATA/ssl/$crt
-                done
+
+                if [ -f "$tmpdir/web/$domain/$backup_system/$domain.crt" ]; then
+                    for crt in $(ls $tmpdir/web/$domain/$backup_system | grep -E '^'$domain'\.(crt|key|ca|pem)$'); do
+                        cp -f "$tmpdir/web/$domain/$backup_system/$crt" "$USER_DATA/ssl/"
+                    done
+                elif [ -f "$tmpdir/web/$domain/conf/ssl.$domain.crt" ]; then
+                    certificates=$(ls $tmpdir/web/$domain/conf| grep ssl)
+                    certificates=$(echo "$certificates" |grep $domain)
+                    for crt in $certificates; do
+                        crt=$(echo $crt|sed -e "s/ssl.//")
+                        cp -f $tmpdir/web/$domain/conf/ssl.$crt $USER_DATA/ssl/$crt
+                    done
+                fi
             fi
 
             # Merging web.conf keys