Skip to content

Commit bca6e29

Browse files
committed
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 hestiacp#834
1 parent 6b1965e commit bca6e29

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

bin/v-restore-user

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -375,12 +375,19 @@ if [ "$web" != 'no' ] && [ ! -z "$WEB_SYSTEM" ]; then
375375

376376
# Copying SSL certificates
377377
if [ "$SSL" = 'yes' ]; then
378-
certificates=$(ls $tmpdir/web/$domain/conf| grep ssl)
379-
certificates=$(echo "$certificates" |grep $domain)
380-
for crt in $certificates; do
381-
crt=$(echo $crt|sed -e "s/ssl.//")
382-
cp -f $tmpdir/web/$domain/conf/ssl.$crt $USER_DATA/ssl/$crt
383-
done
378+
379+
if [ -f "$tmpdir/web/$domain/$backup_system/$domain.crt" ]; then
380+
for crt in $(ls $tmpdir/web/$domain/$backup_system | grep -E '^'$domain'\.(crt|key|ca|pem)$'); do
381+
cp -f "$tmpdir/web/$domain/$backup_system/$crt" "$USER_DATA/ssl/"
382+
done
383+
elif [ -f "$tmpdir/web/$domain/conf/ssl.$domain.crt" ]; then
384+
certificates=$(ls $tmpdir/web/$domain/conf| grep ssl)
385+
certificates=$(echo "$certificates" |grep $domain)
386+
for crt in $certificates; do
387+
crt=$(echo $crt|sed -e "s/ssl.//")
388+
cp -f $tmpdir/web/$domain/conf/ssl.$crt $USER_DATA/ssl/$crt
389+
done
390+
fi
384391
fi
385392

386393
# Merging web.conf keys

0 commit comments

Comments
 (0)