Sfoglia il codice sorgente

Add mail SSL variables to user configuration

Kristan Kenney 7 anni fa
parent
commit
8202dd4217
2 ha cambiato i file con 25 aggiunte e 0 eliminazioni
  1. 1 0
      bin/v-add-user
  2. 24 0
      install/upgrade/0.9.8-29.sh

+ 1 - 0
bin/v-add-user

@@ -179,6 +179,7 @@ U_DNS_RECORDS='0'
 U_MAIL_DOMAINS='0'
 U_MAIL_DKIM='0'
 U_MAIL_ACCOUNTS='0'
+U_MAIL_SSL='0'
 U_DATABASES='0'
 U_CRON_JOBS='0'
 U_BACKUPS='0'

+ 24 - 0
install/upgrade/0.9.8-29.sh

@@ -160,6 +160,29 @@ if [ -f /etc/dovecot/dovecot.conf ]; then
     sleep 0.5
 fi
 
+# Update user information for mail domain SSL configuration
+userlist=$(ls --sort=time $HESTIA/data/users/)
+for user in $userlist; do
+    USER_DATA="$HESTIA/data/users/$user"
+    # Update user counter if SSL variable doesn't exist
+    if [ -z "$(grep "U_MAIL_SSL" $USER_DATA/user.conf)" ]; then
+        echo "(*) Adding missing variable for per-domain mail SSL..."
+        echo "U_MAIL_SSL='0'" >> $USER_DATA/user.conf
+    fi
+
+    # Update mail configuration file
+    conf="$USER_DATA/mail.conf"
+    while read line ; do
+        eval $line
+        
+        add_object_key "mail" 'DOMAIN' "$DOMAIN" 'SSL' 'SUSPENDED'
+        update_object_value 'mail' 'DOMAIN' "$DOMAIN" '$SSL' 'no'
+        
+        add_object_key "mail" 'DOMAIN' "$DOMAIN" 'LETSENCRYPT' 'SUSPENDED'
+        update_object_value 'mail' 'DOMAIN' "$DOMAIN" '$LETSENCRYPT' 'no'
+    done < $conf
+done
+
 # Add IMAP system variable to configuration if dovecot is installed
 if [ -z "$IMAP_SYSTEM" ]; then 
     if [ -f /usr/bin/dovecot ]; then
@@ -174,6 +197,7 @@ for user in `ls /usr/local/hestia/data/users/`; do
     v-rebuild-mail-domains $user
 done
 
+
 # Remove Webalizer and replace it with awstats as default
 echo "(*) Setting awstats as default web statistics backend..."
 apt purge webalizer -y > /dev/null 2>&1