Skip to content

Commit 4513c3a

Browse files
author
Kristan Kenney
committed
Improve SSL certificate check during rebuild
1 parent c25f213 commit 4513c3a

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

func/rebuild.sh

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -498,17 +498,6 @@ rebuild_mail_domain_conf() {
498498
if [ ! -z "$CATCHALL" ]; then
499499
echo "*@$domain_idn:$CATCHALL" >> $dom_aliases
500500
fi
501-
502-
# Remove and recreate SSL configuration
503-
if [ "$SSL" = 'yes' ]; then
504-
del_mail_ssl_config
505-
add_mail_ssl_config
506-
507-
# Update counters
508-
update_object_value 'mail' 'DOMAIN' "$domain" '$SSL' "yes"
509-
U_MAIL_SSL=$((U_MAIL_SSL + 1))
510-
fi
511-
512501
fi
513502

514503
# Rebuild domain accounts
@@ -560,6 +549,15 @@ rebuild_mail_domain_conf() {
560549
chown $user:mail $HOMEDIR/$user/mail/$domain_idn
561550
fi
562551

552+
# Remove and recreate SSL configuration
553+
if [ -f "$HOMEDIR/$user/conf/mail/$domain/ssl/$domain.crt" ]; then
554+
del_mail_ssl_config
555+
add_mail_ssl_config
556+
update_object_value 'mail' 'DOMAIN' "$domain" '$SSL' "yes"
557+
else
558+
update_object_value 'mail' 'DOMAIN' "$domain" '$SSL' "no"
559+
fi
560+
563561
dom_disk=0
564562
for account in $(search_objects "mail/$domain" 'SUSPENDED' "no" 'ACCOUNT'); do
565563
home_dir=$HOMEDIR/$user/mail/$domain/$account

0 commit comments

Comments
 (0)