Browse Source

Implement SSL for mail domains and webmail subdomain support

Kristan Kenney 7 years ago
parent
commit
6c0c403fdc

+ 1 - 3
bin/v-add-backup-host

@@ -169,9 +169,7 @@ fi
 
 # Adding backup host
 if [ $type != 'local' ]; then
-    time_n_date=$(date +'%T %F')
-    time=$(echo "$time_n_date" |cut -f 1 -d \ )
-    date=$(echo "$time_n_date" |cut -f 2 -d \ )
+    new_timestamp
     str="HOST='$host'\nUSERNAME='$user'\nPASSWORD='$password'"
     str="$str\nBPATH='$path'\nPORT='$port'\nTIME='$time'\nDATE='$date'"
     echo -e "$str" > $HESTIA/conf/$type.backup.conf

+ 46 - 33
bin/v-add-letsencrypt-domain

@@ -83,11 +83,11 @@ fi
 #                       Action                             #
 #----------------------------------------------------------#
 
-# Rework domain and alieses for mail.
+# Generate correct variables for mail domain SSL certificates
 if [ ! -z "$mail" ]; then
-    original_domain=$domain
-    aliases="webmail.$domain,autodiscover.$domain"
-    domain="mail.$domain"
+    root_domain=$domain
+    domain="mail.$root_domain"
+    aliases="$WEBMAIL_ALIAS.$root_domain,autodiscover.$root_domain"
 fi
 
 # Registering LetsEncrypt user account
@@ -162,34 +162,38 @@ for auth in $authz; do
         $BIN/v-add-dns-record $user $domain "_acme-challenge" "TXT" $record
         check_result $? "DNS _acme-challenge record wasn't created"
     else
-        if [ "$WEB_SYSTEM" = 'nginx' ] || [ ! -z "$PROXY_SYSTEM" ]; then
-            if [ -z "$mail" ]; then
-                conf="$HOMEDIR/$user/conf/web/$domain/$PROXY_SYSTEM.conf_letsencrypt"
-                sconf="$HOMEDIR/$user/conf/web/$domain/$PROXY_SYSTEM.ssl.conf_letsencrypt"
-            else
-                conf="$HOMEDIR/$user/conf/mail/$original_domain/$PROXY_SYSTEM.conf_letsencryptmail"
-                sconf="$HOMEDIR/$user/conf/mail/$original_domain/$PROXY_SYSTEM.ssl.conf_letsencryptmail"
-            fi
-
-            if [ ! -e "$conf" ]; then
-                echo 'location ~ "^/\.well-known/acme-challenge/(.*)$" {' \
-                    > $conf
-                echo '    default_type text/plain;' >> $conf
-                echo '    return 200 "$1.'$THUMB'";' >> $conf
-                echo '}' >> $conf
-            fi
-            if [ ! -e "$sconf" ]; then
-                ln -s "$conf" "$sconf"
-            fi
-            $BIN/v-restart-proxy
-            check_result $? "Proxy restart failed" > /dev/null
+        if [ -z "$mail" ]; then
+            if [ "$WEB_SYSTEM" = 'nginx' ] || [ ! -z "$PROXY_SYSTEM" ]; then
+                if [ ! -z "$mail" ]; then
+                    conf="$HOMEDIR/$user/conf/mail/$root_domain/$PROXY_SYSTEM.conf_letsencrypt"
+                    sconf="$HOMEDIR/$user/conf/mail/$root_domain/$PROXY_SYSTEM.ssl.conf_letsencrypt"
+                else
+                    conf="$HOMEDIR/$user/conf/web/$domain/$PROXY_SYSTEM.conf_letsencrypt"
+                    sconf="$HOMEDIR/$user/conf/web/$domain/$PROXY_SYSTEM.ssl.conf_letsencrypt"
+                fi
+
+                if [ ! -e "$conf" ]; then
+                    echo 'location ~ "^/\.well-known/acme-challenge/(.*)$" {' \
+                        > $conf
+                    echo '    default_type text/plain;' >> $conf
+                    echo '    return 200 "$1.'$THUMB'";' >> $conf
+                    echo '}' >> $conf
+                fi
+                if [ ! -e "$sconf" ]; then
+                    ln -s "$conf" "$sconf"
+                fi
+                $BIN/v-restart-proxy
+                check_result $? "Proxy restart failed" > /dev/null
 
-        else
-            if [ -z "$mail" ]; then
-                well_known="$HOMEDIR/$user/web/$domain/public_html/.well-known"
             else
-                well_known="/var/lib/roundcube/.well-known"
+                well_known="$HOMEDIR/$user/web/$domain/public_html/.well-known"
+                acme_challenge="$well_known/acme-challenge"
+                mkdir -p $acme_challenge
+                echo "$token.$THUMB" > $acme_challenge/$token
+                chown -R $user:$user $well_known
             fi
+        else
+            well_known="/var/lib/roundcube/.well-known"
             acme_challenge="$well_known/acme-challenge"
             mkdir -p $acme_challenge
             echo "$token.$THUMB" > $acme_challenge/$token
@@ -262,14 +266,23 @@ if [[ $(head -n 1 $ssl_dir/$domain.ca) = "-----END CERTIFICATE-----" ]]; then
     sed -i '1,2d' $ssl_dir/$domain.ca
 fi
 
+# Rename certs for mail
+if [ ! -z "$mail" ]; then
+    mv $ssl_dir/$domain.ca $ssl_dir/$root_domain.ca
+    mv $ssl_dir/$domain.crt $ssl_dir/$root_domain.crt
+    mv $ssl_dir/$domain.csr $ssl_dir/$root_domain.csr
+    mv $ssl_dir/$domain.key $ssl_dir/$root_domain.key
+    mv $ssl_dir/$domain.pem $ssl_dir/$root_domain.pem
+fi
+
 # Adding SSL
 if [ -z "$mail" ]; then
     ssl_home=$(search_objects 'web' 'LETSENCRYPT' 'yes' 'SSL_HOME')
     $BIN/v-delete-web-domain-ssl $user $domain > /dev/null 2>&1
     $BIN/v-add-web-domain-ssl $user $domain $ssl_dir $ssl_home
 else
-    $BIN/v-delete-mail-domain-ssl $user $domain >/dev/null 2>&1
-    $BIN/v-add-mail-domain-ssl $user $domain $ssl_dir
+    $BIN/v-delete-mail-domain-ssl $user $root_domain >/dev/null 2>&1
+    $BIN/v-add-mail-domain-ssl $user $root_domain $ssl_dir
 fi
 
 if [ "$?" -ne '0' ]; then
@@ -295,9 +308,9 @@ if [ -z "$mail" ]; then
     update_object_value 'web' 'DOMAIN' "$domain" '$LETSENCRYPT' 'yes'
 else
     if [ -z "$LETSENCRYPT" ]; then
-        add_object_key "mail" 'DOMAIN' "$original_domain" 'LETSENCRYPT'
+        add_object_key "mail" 'DOMAIN' "$root_domain" 'LETSENCRYPT'
     fi
-    update_object_value 'mail' 'DOMAIN' "$original_domain" '$LETSENCRYPT' 'yes'
+    update_object_value 'mail' 'DOMAIN' "$root_domain" '$LETSENCRYPT' 'yes'
 fi
 
 #----------------------------------------------------------#

+ 16 - 0
bin/v-add-mail-domain

@@ -127,6 +127,14 @@ if [ ! -z "$DNS_SYSTEM" ] && [ "$dkim" = 'yes' ]; then
     fi
 fi
 
+# Add webmail configuration to mail domain
+if [ ! -z "$WEB_SYSTEM" ]; then
+    add_webmail_config "$WEB_SYSTEM" "default.tpl"
+fi
+if [ ! -z "$PROXY_SYSTEM" ]; then
+    add_webmail_config "$PROXY_SYSTEM" "default.tpl"
+fi
+
 #----------------------------------------------------------#
 #                       Hestia                             #
 #----------------------------------------------------------#
@@ -138,6 +146,14 @@ if [ "$dkim" = 'yes' ]; then
     increase_user_value "$user" '$U_MAIL_DKIM'
 fi
 
+# Restarting web server
+$BIN/v-restart-web $restart
+check_result $? "Web restart failed" >/dev/null
+
+# Restarting proxy server
+$BIN/v-restart-proxy $restart
+check_result $? "Proxy restart failed" >/dev/null
+
 # Logging
 log_history "added mail domain $domain"
 log_event "$OK" "$ARGUMENTS"

+ 16 - 10
bin/v-add-mail-domain-ssl

@@ -65,21 +65,20 @@ is_web_domain_cert_valid
 # Call routine to add SSL configuration to mail domain
 add_mail_ssl_config
 
+# Add webmail configuration to mail domain
+if [ ! -z "$WEB_SYSTEM" ]; then
+    add_webmail_config "$WEB_SYSTEM" "default.stpl"
+fi
+if [ ! -z "$PROXY_SYSTEM" ]; then
+    add_webmail_config "$PROXY_SYSTEM" "default.stpl"
+fi
+
 # Increase value for domain
 increase_user_value "$user" '$U_MAIL_SSL'
 
 # Set SSL as enabled in configuration
 update_object_value 'mail' 'DOMAIN' "$domain" '$SSL' "yes"
 
-# Refresh webmail configuration
-if [ ! -z "$WEB_SYSTEM" ]; then
-    add_ssl_webmail_config
-
-    # Restart web services for webmail changes to take effect
-    $BIN/v-restart-web $restart
-    $BIN/v-restart-proxy $restart
-fi
-
 #----------------------------------------------------------#
 #                       Hestia                             #
 #----------------------------------------------------------#
@@ -87,9 +86,16 @@ fi
 # Restarting mail server
 $BIN/v-restart-mail $restart
 $BIN/v-restart-service $IMAP_SYSTEM $restart
-
 check_result $? "Mail restart failed" >/dev/null
 
+# Restarting web server
+$BIN/v-restart-web $restart
+check_result $? "Web restart failed" >/dev/null
+
+# Restarting proxy server
+$BIN/v-restart-proxy $restart
+check_result $? "Proxy restart failed" >/dev/null
+
 # Logging
 log_history "enabled mail ssl support for $domain"
 log_event "$OK" "$ARGUMENTS"

+ 94 - 0
bin/v-add-webmail

@@ -0,0 +1,94 @@
+#!/bin/bash
+# info: add webmail support for a domain
+# options: USER DOMAIN [RESTART]
+#
+
+#----------------------------------------------------------#
+#                    Variable&Function                     #
+#----------------------------------------------------------#
+
+# Argument definition
+user=$1
+domain=$2
+restart="$3"
+
+# Additional argument formatting
+if [[ "$domain" =~ [[:upper:]] ]]; then
+    domain=$(echo "$domain" |tr '[:upper:]' '[:lower:]')
+fi
+if [[ "$domain" =~ ^www\..* ]]; then
+    domain=$(echo "$domain" |sed -e "s/^www.//")
+fi
+if [[ "$domain" =~ .*\.$ ]]; then
+    domain=$(echo "$domain" |sed -e "s/\.$//")
+fi
+
+domain=$(idn -t --quiet -u "$domain" )
+domain_idn=$(idn -t --quiet -a "$domain")
+
+# Includes
+source $HESTIA/func/main.sh
+source $HESTIA/func/domain.sh
+source $HESTIA/func/ip.sh
+source $HESTIA/conf/hestia.conf
+
+# Additional argument formatting
+format_domain
+format_domain_idn
+get_user_ip
+
+#----------------------------------------------------------#
+#                    Verifications                         #
+#----------------------------------------------------------#
+
+check_args '3' "$#" 'USER DOMAIN [RESTART]'
+is_format_valid 'user' 'domain'
+is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM'
+is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM'
+is_object_valid 'user' 'USER' "$user"
+is_object_unsuspended 'user' 'USER' "$user"
+is_object_valid 'mail' 'DOMAIN' "$domain"
+is_object_unsuspended 'mail' 'DOMAIN' "$domain"
+is_object_valid 'web' 'DOMAIN' "$domain"
+is_object_unsuspended 'web' 'DOMAIN' "$domain"
+
+#----------------------------------------------------------#
+#                       Action                             #
+#----------------------------------------------------------#
+
+# Add webmail configuration to mail domain
+if [ ! -z "$WEB_SYSTEM" ]; then
+    add_webmail_config "$WEB_SYSTEM" "default.tpl"
+fi
+if [ ! -z "$PROXY_SYSTEM" ]; then
+    add_webmail_config "$PROXY_SYSTEM" "default.tpl"
+fi
+
+# Enable SSL for webmail if available
+if [ -f $HOMEDIR/$user/conf/mail/$domain/ssl/$domain.crt ]; then
+    if [ ! -z "$WEB_SYSTEM" ]; then
+        add_webmail_config "$WEB_SYSTEM" "default.stpl"
+    fi
+    if [ ! -z "$PROXY_SYSTEM" ]; then
+        add_webmail_config "$PROXY_SYSTEM" "default.stpl"
+    fi
+fi
+
+#----------------------------------------------------------#
+#                       Hestia                             #
+#----------------------------------------------------------#
+
+if [ ! -z "$3" ]; then 
+    # Restarting web server
+    $BIN/v-restart-web $restart
+    check_result $? "Web restart failed" >/dev/null
+
+    $BIN/v-restart-proxy $restart
+    check_result $? "Proxy restart failed" >/dev/null
+fi
+
+# Logging
+log_history "enabled webmail support for $domain"
+log_event "$OK" "$ARGUMENTS"
+
+exit

+ 3 - 0
bin/v-delete-mail-domain

@@ -67,6 +67,9 @@ if [ "$SSL" = 'yes' ]; then
     del_mail_ssl_config
 fi
 
+# Delete webmail configuration
+del_webmail_config
+
 #----------------------------------------------------------#
 #                       Hestia                             #
 #----------------------------------------------------------#

+ 0 - 5
bin/v-delete-mail-domain-ssl

@@ -42,11 +42,6 @@ is_object_value_exist 'mail' 'DOMAIN' "$domain" '$SSL'
 # Delete mail domain SSL configuration
 del_mail_ssl_config
 
-# Delete SSL webmail configuration
-if [ ! -z "$WEB_SYSTEM" ]; then
-    del_webmail_ssl_config
-fi
-
 #----------------------------------------------------------#
 #                       Hestia                              #
 #----------------------------------------------------------#

+ 62 - 0
bin/v-delete-webmail

@@ -0,0 +1,62 @@
+#!/bin/bash
+# info: delete webmail support for a domain
+# options: USER DOMAIN [RESTART]
+#
+# The function delete ssl certificates.
+
+#----------------------------------------------------------#
+#                    Variable&Function                     #
+#----------------------------------------------------------#
+
+# Includes
+source $HESTIA/func/main.sh
+source $HESTIA/func/domain.sh
+source $HESTIA/conf/hestia.conf
+
+# Argument definition
+user=$1
+domain=$2
+restart="$3"
+
+# Additional argument formatting
+format_domain
+format_domain_idn
+
+#----------------------------------------------------------#
+#                    Verifications                         #
+#----------------------------------------------------------#
+
+check_args '2' "$#" 'USER DOMAIN [RESTART]'
+is_format_valid 'user' 'domain'
+is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM'
+is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM'
+is_object_valid 'user' 'USER' "$user"
+is_object_unsuspended 'user' 'USER' "$user"
+is_object_valid 'mail' 'DOMAIN' "$domain"
+is_object_unsuspended 'mail' 'DOMAIN' "$domain"
+
+#----------------------------------------------------------#
+#                       Action                             #
+#----------------------------------------------------------#
+
+# Delete webmail configuration
+del_webmail_config
+
+#----------------------------------------------------------#
+#                       Hestia                              #
+#----------------------------------------------------------#
+
+if [ ! -z "$3" ]; then
+    # Restarting web server
+    $BIN/v-restart-web $restart
+    check_result $? "Web restart failed" >/dev/null
+
+    $BIN/v-restart-proxy $restart
+    check_result $? "Proxy restart failed" >/dev/null
+fi
+
+# Logging
+log_history "disabled webmail support for $domain"
+log_event "$OK" "$ARGUMENTS"
+
+exit

+ 1 - 3
bin/v-list-sys-rrd

@@ -21,9 +21,7 @@ json_list() {
     echo "{"
 
     # Generating timestamp
-    time_n_date=$(date +'%T %F')
-    TIME=$(echo "$time_n_date" |cut -f 1 -d \ )
-    DATE=$(echo "$time_n_date" |cut -f 2 -d \ )
+    new_timestamp
 
     for type in $rrd_types; do
         for rrd in $(ls $RRD/$type |grep rrd$ |sed "s/\.rrd$//g"); do

+ 5 - 0
bin/v-rebuild-mail-domains

@@ -53,6 +53,11 @@ fi
 # Starting loop
 for domain in $(search_objects 'mail' 'SUSPENDED' "*" 'DOMAIN'); do
     rebuild_mail_domain_conf
+    if [ ! -z "$WEB_SYSTEM" ] || [ ! -z "$PROXY_SYSTEM" ]; then
+        $BIN/v-delete-webmail $1 $domain ''
+        $BIN/v-add-webmail $1 $domain '' 
+        sleep 0.5
+    fi
 done
 
 

+ 57 - 0
bin/v-update-mail-templates

@@ -0,0 +1,57 @@
+#!/bin/bash
+# info: update mail templates
+# options: [RESTART]
+#
+# The function for obtaining updated pack of mail templates.
+
+
+#----------------------------------------------------------#
+#                    Variable&Function                     #
+#----------------------------------------------------------#
+
+# Argument definition
+restart=$1
+
+# Includes
+source $HESTIA/func/main.sh
+source $HESTIA/conf/hestia.conf
+
+# Detect OS
+case $(head -n1 /etc/issue | cut -f 1 -d ' ') in
+    Debian)     type="debian" ;;
+    Ubuntu)     type="ubuntu" ;;
+    *)          type="NoSupport" ;;
+esac
+
+# Detect version
+if [ "$type" = "ubuntu" ] || [ "$type" = "debian" ]; then
+    type="deb"
+else
+    echo "Error: can't detect supported os"
+    log_event "$E_NOTEXIST"
+    exit $E_NOTEXIST
+fi
+
+
+#----------------------------------------------------------#
+#                       Action                             #
+#----------------------------------------------------------#
+
+# Update templates
+cp -rf $HESTIA/install/$type/templates/mail $HESTIA/data/templates/
+
+#----------------------------------------------------------#
+#                       Hestia                             #
+#----------------------------------------------------------#
+
+# Restarting web server
+$BIN/v-restart-web $restart
+check_result $? "restart" >/dev/null 2>&1
+
+$BIN/v-restart-proxy $restart
+check_result $? "restart" >/dev/null 2>&1
+
+$BIN/v-restart-proxy $restart
+check_result $? "restart" >/dev/null 2>&1
+
+exit

+ 110 - 4
func/domain.sh

@@ -234,15 +234,15 @@ add_web_config() {
         echo "include $conf;" > /etc/$1/conf.d/domains/$domain.ssl.conf
 
         # Clear old configurations
-        rm -fr $HOMEDIR/$user/conf/web/$domain.*
-        rm -fr $HOMEDIR/$user/conf/web/ssl.$domain.*
-        rm -fr $HOMEDIR/$user/conf/web/*nginx.$domain.*
+        rm -rf $HOMEDIR/$user/conf/web/$domain.*
+        rm -rf $HOMEDIR/$user/conf/web/ssl.$domain.*
+        rm -rf $HOMEDIR/$user/conf/web/*nginx.$domain.*
     else
         rm -f /etc/$1/conf.d/domains/$domain.conf
         echo "include $conf;" > /etc/$1/conf.d/domains/$domain.conf
 
         # Clear old configurations
-        rm -fr $HOMEDIR/$user/conf/web/$domain.*
+        rm -rf $HOMEDIR/$user/conf/web/$domain.*
     fi
 
     if [ "$1" != 'nginx' ]; then
@@ -584,6 +584,82 @@ is_mail_new() {
     fi
 }
 
+# Add webmail config
+add_webmail_config() {
+    mkdir -p "$HOMEDIR/$user/conf/mail/$domain"
+    conf="$HOMEDIR/$user/conf/mail/$domain/$1.conf"
+    if [[ "$2" =~ stpl$ ]]; then
+        conf="$HOMEDIR/$user/conf/mail/$domain/$1.ssl.conf"
+    fi
+
+    domain_idn=$domain
+    format_domain_idn
+
+    ssl_crt="$HOMEDIR/$user/conf/mail/$domain/ssl/$domain.crt"
+    ssl_key="$HOMEDIR/$user/conf/mail/$domain/ssl/$domain.key"
+    ssl_pem="$HOMEDIR/$user/conf/mail/$domain/ssl/$domain.pem"
+    ssl_ca="$HOMEDIR/$user/conf/mail/$domain/ssl/$domain.ca"
+
+    cat $MAILTPL/$1/$2 | \
+        sed -e "s|%ip%|$local_ip|g" \
+            -e "s|%domain%|$WEBMAIL_ALIAS.$domain|g" \
+            -e "s|%domain_idn%|$domain_idn|g" \
+            -e "s|%root_domain%|$domain|g" \
+            -e "s|%alias%|mail.$domain autodiscover.$domain|g" \
+            -e "s|%alias_idn%|${aliases_idn//,/ }|g" \
+            -e "s|%alias_string%|$alias_string|g" \
+            -e "s|%email%|info@$domain|g" \
+            -e "s|%web_system%|$WEB_SYSTEM|g" \
+            -e "s|%web_port%|$WEB_PORT|g" \
+            -e "s|%web_ssl_port%|$WEB_SSL_PORT|g" \
+            -e "s|%backend_lsnr%|$backend_lsnr|g" \
+            -e "s|%rgroups%|$WEB_RGROUPS|g" \
+            -e "s|%proxy_system%|$PROXY_SYSTEM|g" \
+            -e "s|%proxy_port%|$PROXY_PORT|g" \
+            -e "s|%proxy_ssl_port%|$PROXY_SSL_PORT|g" \
+            -e "s/%proxy_extentions%/${PROXY_EXT//,/|}/g" \
+            -e "s|%user%|$user|g" \
+            -e "s|%group%|$user|g" \
+            -e "s|%home%|$HOMEDIR|g" \
+            -e "s|%docroot%|$docroot|g" \
+            -e "s|%sdocroot%|$sdocroot|g" \
+            -e "s|%ssl_crt%|$ssl_crt|g" \
+            -e "s|%ssl_key%|$ssl_key|g" \
+            -e "s|%ssl_pem%|$ssl_pem|g" \
+            -e "s|%ssl_ca_str%|$ssl_ca_str|g" \
+            -e "s|%ssl_ca%|$ssl_ca|g" \
+    > $conf
+
+    chown root:$user $conf
+    chmod 640 $conf
+
+    if [ "$2" = "default.tpl" ]; then
+        if [ ! -z "$WEB_SYSTEM" ]; then
+            rm -f /etc/$1/conf.d/domains/$WEBMAIL_ALIAS.$domain.conf
+            ln -s $conf /etc/$1/conf.d/domains/$WEBMAIL_ALIAS.$domain.conf
+        fi
+        if [ ! -z "$PROXY_SYSTEM" ]; then
+            rm -f /etc/$1/conf.d/domains/$WEBMAIL_ALIAS.$domain.conf
+            ln -s $conf /etc/$1/conf.d/domains/$WEBMAIL_ALIAS.$domain.conf
+        fi
+        # Clear old configurations
+        rm -rf $HOMEDIR/$user/conf/mail/$domain.*
+    fi
+    if [ "$2" = "default.stpl" ]; then
+        if [ ! -z "$WEB_SYSTEM" ]; then
+            rm -f /etc/$1/conf.d/domains/$WEBMAIL_ALIAS.$domain.ssl.conf
+            ln -s $conf /etc/$1/conf.d/domains/$WEBMAIL_ALIAS.$domain.ssl.conf
+        fi
+        if [ ! -z "$PROXY_SYSTEM" ]; then
+            rm -f /etc/$1/conf.d/domains/$WEBMAIL_ALIAS.$domain.ssl.conf
+            ln -s $conf /etc/$1/conf.d/domains/$WEBMAIL_ALIAS.$domain.ssl.conf
+        fi
+        # Clear old configurations
+        rm -rf $HOMEDIR/$user/conf/mail/$domain.*
+        rm -rf $HOMEDIR/$user/conf/mail/ssl.$domain.*
+        rm -rf $HOMEDIR/$user/conf/mail/*nginx.$domain.*
+    fi
+}
 
 # Add mail server SSL configuration
 add_mail_ssl_config() {
@@ -662,6 +738,36 @@ del_mail_ssl_config() {
     rm -f /usr/local/hestia/ssl/mail/mail.$domain.*
 }
 
+# Delete webmail support
+del_webmail_config() {
+    if [ ! -z "$WEB_SYSTEM" ]; then 
+        rm -f $HOMEDIR/$user/conf/mail/$domain/$WEB_SYSTEM.conf
+        rm -f /etc/$WEB_SYSTEM/conf.d/domains/$WEBMAIL_ALIAS.$domain.conf
+        rm -f $HOMEDIR/$user/conf/mail/$domain/$WEB_SYSTEM.ssl.conf
+        rm -f /etc/$WEB_SYSTEM/conf.d/domains/$WEBMAIL_ALIAS.$domain.ssl.conf
+    fi
+
+    if [ ! -z "$PROXY_SYSTEM" ]; then
+        rm -f $HOMEDIR/$user/conf/mail/$domain/$PROXY_SYSTEM.conf
+        rm -f /etc/$PROXY_SYSTEM/conf.d/domains/$WEBMAIL_ALIAS.$domain.conf
+        rm -f $HOMEDIR/$user/conf/mail/$domain/$PROXY_SYSTEM.ssl.conf
+        rm -f /etc/$PROXY_SYSTEM/conf.d/domains/$WEBMAIL_ALIAS.$domain.ssl.conf
+    fi
+}
+
+# Delete SSL webmail support
+del_webmail_ssl_config() {
+    if [ ! -z "$WEB_SYSTEM" ]; then 
+        rm -f $HOMEDIR/$user/conf/mail/$domain/$WEB_SYSTEM.ssl.conf
+        rm -f /etc/$WEB_SYSTEM/conf.d/domains/$WEBMAIL_ALIAS.$domain.ssl.conf
+    fi
+    
+    if [ ! -z "$PROXY_SYSTEM" ]; then
+        rm -f $HOMEDIR/$user/conf/mail/$domain/$PROXY_SYSTEM.ssl.conf
+        rm -f /etc/$PROXY_SYSTEM/conf.d/domains/$WEBMAIL_ALIAS.$domain.ssl.conf
+    fi
+}
+
 #----------------------------------------------------------#
 #                        CMN                               #
 #----------------------------------------------------------#

+ 8 - 0
func/main.sh

@@ -9,6 +9,7 @@ RRD_STEP=300
 BIN=$HESTIA/bin
 USER_DATA=$HESTIA/data/users/$user
 WEBTPL=$HESTIA/data/templates/web
+MAILTPL=$HESTIA/data/templates/mail
 DNSTPL=$HESTIA/data/templates/dns
 RRD=$HESTIA/web/rrd
 SENDMAIL="$HESTIA/web/inc/mail-wrapper.php"
@@ -36,6 +37,13 @@ E_RRD=18
 E_UPDATE=19
 E_RESTART=20
 
+# Generate time stamp
+new_timestamp() {
+    time_n_date=$(date +'%T %F')
+    time=$(echo "$time_n_date" |cut -f 1 -d \ )
+    date=$(echo "$time_n_date" |cut -f 2 -d \ )
+}
+
 # Event string for logger
 for ((I=1; I <= $# ; I++)); do
     if [[ "$HIDE" != $I ]]; then

+ 1 - 1
func/rebuild.sh

@@ -439,7 +439,6 @@ rebuild_dns_domain_conf() {
 
 # MAIL domain rebuild
 rebuild_mail_domain_conf() {
-
     get_domain_values 'mail'
 
     if [[ "$domain" = *[![:ascii:]]* ]]; then
@@ -509,6 +508,7 @@ rebuild_mail_domain_conf() {
             update_object_value 'mail' 'DOMAIN' "$domain" '$SSL' "yes"
             U_MAIL_SSL=$((U_MAIL_SSL + 1))
         fi
+
     fi
 
     # Rebuild domain accounts

+ 0 - 82
install/deb/nginx/webmail.conf

@@ -1,82 +0,0 @@
-server {
-    listen      %ip%:%proxy_port%;
-    server_name %webmail_alias%.*;
-
-    location / {
-        proxy_pass      http://%ip%:%web_port%;
-        location ~* ^.+\.(jpg,jpeg,gif,png,ico,svg,css,zip,tgz,gz,rar,bz2,doc,xls,exe,pdf,ppt,txt,odt,ods,odp,odf,tar,wav,bmp,rtf,js,mp3,avi,mpeg,flv,html,htm)$ {
-            alias          /var/lib/roundcube/;
-            expires        15m;
-            try_files      $uri @fallback;
-        }
-    }
-
-    location /error/ {
-        alias   /var/www/document_errors/;
-    }
-
-    location ~ /(config|temp|logs) {
-        return 404;
-    }
-
-    location ~ ^/(.*\.php)$ {
-        alias /var/lib/roundcube/$1;
-        fastcgi_pass 127.0.0.1:9000;
-        fastcgi_index index.php;
-        include fastcgi_params;
-        fastcgi_param SCRIPT_FILENAME $request_filename;
-    }
-    
-    location @fallback {
-        proxy_pass      http://%ip%:%web_port%;
-    }
-
-    location ~ /\.ht    {return 404;}
-    location ~ /\.svn/  {return 404;}
-    location ~ /\.git/  {return 404;}
-    location ~ /\.hg/   {return 404;}
-    location ~ /\.bzr/  {return 404;}
-}
-
-server {
-    listen      %ip%:%proxy_ssl_port% ssl http2;
-    server_name %webmail_alias%.*;
-    ssl_certificate      /usr/local/hestia/ssl/certificate.crt;
-    ssl_certificate_key  /usr/local/hestia/ssl/certificate.key;
-
-    location / {
-        proxy_pass      https://%ip%:%web_ssl_port%;
-        location ~* ^.+\.(jpg,jpeg,gif,png,ico,svg,css,zip,tgz,gz,rar,bz2,doc,xls,exe,pdf,ppt,txt,odt,ods,odp,odf,tar,wav,bmp,rtf,js,mp3,avi,mpeg,flv,html,htm)$ {
-            alias          /var/lib/roundcube/;
-            expires        15m;
-            try_files      $uri @fallback;
-        }
-    }
-
-    location /error/ {
-        alias   /var/www/document_errors/;
-    }
-
-    location ~ /(config|temp|logs) {
-        return 404;
-    }
-
-    location ~ ^/(.*\.php)$ {
-        alias /var/lib/roundcube/$1;
-        fastcgi_pass 127.0.0.1:9000;
-        fastcgi_index index.php;
-        include fastcgi_params;
-        fastcgi_param SCRIPT_FILENAME $request_filename;
-    }
-
-    location @fallback {
-        proxy_pass      https://%ip%:%web_ssl_port%;
-    }
-
-    location ~ /\.ht    {return 404;}
-    location ~ /\.svn/  {return 404;}
-    location ~ /\.git/  {return 404;}
-    location ~ /\.hg/   {return 404;}
-    location ~ /\.bzr/  {return 404;}
-
-}

+ 0 - 90
install/deb/roundcube/apache.conf

@@ -1,90 +0,0 @@
-<VirtualHost %ip%:%web_port%>
-    ServerAlias %webmail_alias%.*
-    Alias / /var/lib/roundcube/
-    Alias /error/ /var/www/document_errors/
-    #SuexecUserGroup %user% %group%
-    
-    <Directory "/usr/share/tinymce/www/">
-      Options Indexes MultiViews FollowSymLinks
-      AllowOverride None
-      Order allow,deny
-      allow from all
-    </Directory>
-
-    <Directory /var/lib/roundcube/>
-        Options +FollowSymLinks
-        # This is needed to parse /var/lib/roundcube/.htaccess. See its
-        # content before setting AllowOverride to None.
-        AllowOverride All
-        order allow,deny
-        allow from all
-    </Directory>
-
-    # Protecting basic directories:
-    <Directory /var/lib/roundcube/config>
-            Options -FollowSymLinks
-            AllowOverride None
-    </Directory>
-
-    <Directory /var/lib/roundcube/temp>
-            Options -FollowSymLinks
-            AllowOverride None
-        Order allow,deny
-        Deny from all
-    </Directory>
-
-    <Directory /var/lib/roundcube/logs>
-            Options -FollowSymLinks
-            AllowOverride None
-        Order allow,deny
-        Deny from all
-    </Directory>
-</VirtualHost>
-
-<VirtualHost %ip%:%web_ssl_port%>
-    ServerAlias %webmail_alias%.*
-    Alias / /var/lib/roundcube/
-    Alias /error/ %home%/%user%/web/%domain%/document_errors/
-    #SuexecUserGroup %user% %group%
-    
-    SSLEngine on
-    SSLVerifyClient none
-    SSLCertificateFile         /usr/local/hestia/ssl/certificate.crt
-    SSLCertificateKeyFile      /usr/local/hestia/ssl/certificate.key
-
-    <Directory "/usr/share/tinymce/www/">
-      Options Indexes MultiViews FollowSymLinks
-      AllowOverride None
-      Order allow,deny
-      allow from all
-    </Directory>
-
-    <Directory /var/lib/roundcube/>
-        Options +FollowSymLinks
-        # This is needed to parse /var/lib/roundcube/.htaccess. See its
-        # content before setting AllowOverride to None.
-        AllowOverride All
-        order allow,deny
-        allow from all
-    </Directory>
-
-    # Protecting basic directories:
-    <Directory /var/lib/roundcube/config>
-            Options -FollowSymLinks
-            AllowOverride None
-    </Directory>
-
-    <Directory /var/lib/roundcube/temp>
-            Options -FollowSymLinks
-            AllowOverride None
-        Order allow,deny
-        Deny from all
-    </Directory>
-
-    <Directory /var/lib/roundcube/logs>
-            Options -FollowSymLinks
-            AllowOverride None
-        Order allow,deny
-        Deny from all
-    </Directory>
-</VirtualHost>

+ 9 - 5
install/deb/templates/mail/apache2/default.stpl

@@ -1,15 +1,16 @@
 <VirtualHost %ip%:%web_ssl_port%>
-    ServerName %webmail_vhost%
+    ServerName %domain%
+    ServerAlias %alias
     Alias / /var/lib/roundcube/
-    Alias /error/ %home%/%user%/web/%domain%/document_errors/
+    Alias /error/ %home%/%user%/web/%root_domain%/document_errors/
     #SuexecUserGroup %user% %group%
     
     SSLEngine on
     SSLVerifyClient none
-    SSLCertificateFile         %home%/%user%/conf/mail/%domain%/ssl/%domain%.crt
-    SSLCertificateKeyFile      %home%/%user%/conf/mail/%domain%/ssl/%domain%.key
+    SSLCertificateFile         %home%/%user%/conf/mail/%root_domain%/ssl/%root_domain%.crt
+    SSLCertificateKeyFile      %home%/%user%/conf/mail/%root_domain%/ssl/%root_domain%.key
 
-   IncludeOptional %home%/%user%/conf/web/%domain%/apache2.forcessl.conf*
+   IncludeOptional %home%/%user%/conf/web/%root_domain%/apache2.forcessl.conf*
     
     <Directory "/usr/share/tinymce/www/">
       Options Indexes MultiViews FollowSymLinks
@@ -46,4 +47,7 @@
         Order allow,deny
         Deny from all
     </Directory>
+
+    IncludeOptional %home%/%user%/conf/mail/%root_domain%/%web_system%.ssl.conf_*
+
 </VirtualHost>

+ 7 - 3
install/deb/templates/mail/apache2/default.tpl

@@ -1,10 +1,11 @@
 <VirtualHost %ip%:%web_port%>
-    ServerName %webmail_vhost%
+    ServerName %domain%
+    ServerAlias %alias%
     Alias / /var/lib/roundcube/
-    Alias /error/ %home%/%user%/web/%domain%/document_errors/
+    Alias /error/ %home%/%user%/web/%root_domain%/document_errors/
     #SuexecUserGroup %user% %group%
         
-    IncludeOptional %home%/%user%/conf/web/%domain%/apache2.forcessl.conf*
+    IncludeOptional %home%/%user%/conf/web/%root_domain%/apache2.forcessl.conf*
     
     <Directory "/usr/share/tinymce/www/">
       Options Indexes MultiViews FollowSymLinks
@@ -41,4 +42,7 @@
         Order allow,deny
         Deny from all
     </Directory>
+
+    IncludeOptional %home%/%user%/conf/mail/%root_domain%/%web_system%.conf_*
+
 </VirtualHost>

+ 3 - 3
install/deb/templates/mail/nginx/default.stpl

@@ -1,6 +1,6 @@
 server {
     listen      %ip%:%proxy_ssl_port% ssl http2;
-    server_name %domain_idn% %alias_idn%;
+    server_name %domain% %alias%;
     ssl_certificate      %ssl_pem%;
     ssl_certificate_key  %ssl_key%;
     error_log  /var/log/%web_system%/domains/%domain%.error.log error;
@@ -17,7 +17,7 @@ server {
     }
 
     location /error/ {
-        alias   %home%/%user%/web/%domain%/document_errors/;
+        alias   %home%/%user%/web/%root_domain%/document_errors/;
     }
 
     location @fallback {
@@ -30,6 +30,6 @@ server {
     location ~ /\.hg/   {return 404;}
     location ~ /\.bzr/  {return 404;}
 
-    include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
+    include %home%/%user%/conf/mail/%root_domain%/nginx.ssl.conf_*;
 }
 

+ 5 - 3
install/deb/templates/mail/nginx/default.tpl

@@ -1,8 +1,8 @@
 server {
     listen      %ip%:%proxy_port%;
-    server_name %webmail_vhost%;
+    server_name %domain% %alias%;
         
-    include %home%/%user%/conf/web/%domain/nginx.forcessl.conf*;
+    include %home%/%user%/conf/web/%domain%/nginx.forcessl.conf*;
     location / {
         proxy_pass      http://%ip%:%web_port%;
         location ~* ^.+\.(jpg,jpeg,gif,png,ico,svg,css,zip,tgz,gz,rar,bz2,doc,xls,exe,pdf,ppt,txt,odt,ods,odp,odf,tar,wav,bmp,rtf,js,mp3,avi,mpeg,flv,html,htm)$ {
@@ -13,7 +13,7 @@ server {
     }
 
     location /error/ {
-        alias   %home%/%user%/web/%domain%/document_errors/;
+        alias   %home%/%user%/web/%root_domain%/document_errors/;
     }
 
     location ~ /(config|temp|logs) {
@@ -37,4 +37,6 @@ server {
     location ~ /\.git/  {return 404;}
     location ~ /\.hg/   {return 404;}
     location ~ /\.bzr/  {return 404;}
+
+    include %home%/%user%/conf/mail/%root_domain%/nginx.conf_*;
 }

+ 58 - 56
install/upgrade/0.9.8-29.sh

@@ -1,5 +1,4 @@
 #!/bin/bash
-
 # define vars
 HESTIA="/usr/local/hestia"
 HESTIA_BACKUP="/root/hst_upgrade/$(date +%d%m%Y%H%M)"
@@ -19,7 +18,23 @@ source /usr/local/hestia/func/main.sh
 mkdir -p $HESTIA_BACKUP/templates/
 mkdir -p $HESTIA_BACKUP/packages/
 
-echo "(*) Upgrading to Hestia Control Panel v$VERSION..."
+# Clear the screen from apt output to prepare for upgrade installer experience
+clear
+echo
+echo '  _   _           _   _        ____ ____  '
+echo ' | | | | ___  ___| |_(_) __ _ / ___|  _ \ '
+echo ' | |_| |/ _ \/ __| __| |/ _` | |   | |_) |'
+echo ' |  _  |  __/\__ \ |_| | (_| | |___|  __/ '
+echo ' |_| |_|\___||___/\__|_|\__,_|\____|_|    '
+echo
+echo '                      Hestia Control Panel'
+echo -e "\n\n"
+echo "Upgrading to Hestia Control Panel v$VERSION..."
+echo "==================================================="
+echo ""
+echo "This process may take a few minutes, please wait..."
+echo ""
+echo ""
 
 # Update Apache and NGINX configuration to support new file structure
 if [ -f /etc/apache2/apache.conf ]; then
@@ -67,6 +82,7 @@ if [ -d $HESTIA/data/templates/ ]; then
     cp -rf $HESTIA/data/templates $HESTIA_BACKUP/
     $HESTIA/bin/v-update-web-templates
     $HESTIA/bin/v-update-dns-templates
+    $HESTIA/bin/v-update-mail-templates
 fi
 
 # Remove old Office 365 template as there is a newer version with an updated name
@@ -166,6 +182,12 @@ if [ -f /etc/dovecot/conf.d/15-mailboxes.conf ]; then
     # Remove mailboxes configuration if it exists
     rm -f /etc/dovecot/conf.d/15-mailboxes.conf
 fi
+if [ -f /etc/dovecot/dovecot.conf ]; then
+    # Update dovecot configuration and restart dovecot service
+    cp -f $HESTIA/install/deb/dovecot/dovecot.conf /etc/dovecot/dovecot.conf
+    systemctl restart dovecot
+    sleep 0.5
+fi
 
 # Fix exim configuration
 if [ -f /etc/exim4/exim4.conf.template ]; then
@@ -180,54 +202,6 @@ if [ -f /etc/exim4/exim4.conf.template ]; then
     fi
 fi
 
-if [ -f /etc/dovecot/dovecot.conf ]; then
-    # Update dovecot configuration and restart dovecot service
-    cp -f $HESTIA/install/deb/dovecot/dovecot.conf /etc/dovecot/dovecot.conf
-    systemctl restart dovecot
-    sleep 0.5
-fi
-
-# Update Roundcube webmail configuration
-if [ "$WEB_SYSTEM" = 'apache2' ]; then
-    echo "(*) Updating Roundcube global subdomain configuration for apache2..."
-    cp -f $HESTIA/install/deb/roundcube/apache.conf /etc/apache2/conf.d/roundcube.conf
-fi
-if [ ! -z "$PROXY_SYSTEM" ]; then
-    echo "(*) Updating Roundcube global subdomain configuration for nginx..."
-    if [ -f /etc/nginx/conf.d/webmail.inc ]; then
-        rm -f /etc/nginx/conf.d/webmail.inc
-    fi
-    cp -f $HESTIA/install/deb/nginx/webmail.conf /etc/nginx/conf.d/webmail.conf
-fi
-
-# Write web server configuration
-    sed -i 's|%webmail_alias%|'$WEBMAIL_ALIAS'|g' /etc/apache2/conf.d/roundcube.conf
-    sed -i 's|%domain%|'$domain'|g'  /etc/apache2/conf.d/roundcube.conf
-    sed -i 's|%domain_idn%|'$domain'|g'  /etc/apache2/conf.d/roundcube.conf
-    sed -i 's|%home%|'$HOMEDIR'|g'  /etc/apache2/conf.d/roundcube.conf
-    sed -i 's|%user%|'$user'|g'  /etc/apache2/conf.d/roundcube.conf
-    sed -i 's|%group%|'$user'|g'  /etc/apache2/conf.d/roundcube.conf
-    sed -i 's|%ip%|'$ipaddr'|g'  /etc/apache2/conf.d/roundcube.conf
-    sed -i 's|%web_port%|'$WEB_PORT'|g'  /etc/apache2/conf.d/roundcube.conf
-    sed -i 's|%proxy_port%|'$PROXY_PORT'|g' /etc/apache2/conf.d/roundcube.conf
-    sed -i 's|%web_ssl_port%|'$WEB_SSL_PORT'|g'  /etc/apache2/conf.d/roundcube.conf
-    sed -i 's|%proxy_ssl_port%|'$PROXY_SSL_PORT'|g'  /etc/apache2/conf.d/roundcube.conf
-    sed -i 's|%web_system%|'$WEB_SYSTEM'|g' /etc/apache2/conf.d/roundcube.conf
-
-# Write proxy server configurationls
-    sed -i 's|%webmail_alias%|'$WEBMAIL_ALIAS'|g' /etc/nginx/conf.d/webmail.conf
-    sed -i 's|%domain%|'$domain'|g' /etc/nginx/conf.d/webmail.conf
-    sed -i 's|%domain_idn%|'$domain'|g' /etc/nginx/conf.d/webmail.conf
-    sed -i 's|%home%|'$HOMEDIR'|g' /etc/nginx/conf.d/webmail.conf
-    sed -i 's|%user%|'$user'|g' /etc/nginx/conf.d/webmail.conf
-    sed -i 's|%group%|'$user'|g' /etc/nginx/conf.d/webmail.conf
-    sed -i 's|%ip%|'$ipaddr'|g' /etc/nginx/conf.d/webmail.conf
-    sed -i 's|%web_port%|'$WEB_PORT'|g' /etc/nginx/conf.d/webmail.conf
-    sed -i 's|%proxy_port%|'$PROXY_PORT'|g' /etc/nginx/conf.d/webmail.conf
-    sed -i 's|%web_ssl_port%|'$WEB_SSL_PORT'|g' /etc/nginx/conf.d/webmail.conf
-    sed -i 's|%proxy_ssl_port%|'$PROXY_SSL_PORT'|g' /etc/nginx/conf.d/webmail.conf
-    sed -i 's|%web_system%|'$WEB_SYSTEM'|g' /etc/nginx/conf.d/webmail.conf
-
 # Add IMAP system variable to configuration if dovecot is installed
 if [ -z "$IMAP_SYSTEM" ]; then 
     if [ -f /usr/bin/dovecot ]; then
@@ -236,6 +210,20 @@ if [ -z "$IMAP_SYSTEM" ]; then
     fi
 fi
 
+# Remove global webmail configuration files in favor of per-domain vhosts
+if [ -f /etc/apache2/conf.d/roundcube.conf ]; then
+    echo "(*) Removing global webmail configuration files for Apache2..."
+    rm -f /etc/apache2/conf.d/roundcube.conf
+fi
+if [ -f /etc/nginx/conf.d/webmail.inc ]; then
+    echo "(*) Removing global webmail configuration files for nginx..."
+    rm -f /etc/nginx/conf.d/webmail.inc 
+fi
+if [ -f /etc/nginx/conf.d/webmail.conf ]; then
+    echo "(*) Removing global webmail configuration files for nginx..."
+    rm -f /etc/nginx/conf.d/webmail.conf
+fi
+
 # 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
@@ -247,10 +235,24 @@ $HESTIA/bin/v-add-sys-sftp-jail
 # Rebuild user
 for user in `ls /usr/local/hestia/data/users/`; do
     echo "(*) Rebuilding domains and account for user: $user..."
-    v-rebuild-web-domains $user
-    sleep 0.5
-    v-rebuild-dns-domains $user
-    sleep 0.5
-    v-rebuild-mail-domains $user
-    sleep 0.5
+    v-rebuild-web-domains $user >/dev/null 2>&1
+    sleep 1
+    v-rebuild-dns-domains $user >/dev/null 2>&1
+    sleep 1
+    v-rebuild-mail-domains $user >/dev/null 2>&1
+    sleep 1
 done
+echo ""
+echo "    Upgrade complete! Please report any bugs or issues to"
+echo "    https://github.com/hestiacp/hestiacp/issues."
+echo ""
+echo "    We hope that you enjoy this release of Hestia Control Panel,"
+echo "    enjoy your day!"
+echo ""
+echo "    Sincerely,"
+echo "    The Hestia Control Panel development team"
+echo ""
+echo "    www.hestiacp.com"
+echo "    Made with love & pride from the open-source community around the world."
+echo ""
+echo ""

+ 1 - 1
web/edit/mail/index.php

@@ -244,7 +244,7 @@ if ((!empty($_POST['save'])) && (!empty($_GET['domain'])) && (empty($_GET['accou
 
     // Delete Lets Encrypt support
     if (( $v_letsencrypt == 'yes' ) && (empty($_POST['v_letsencrypt'])) && (empty($_SESSION['error_msg']))) {
-        exec (HESTIA_CMD."v-delete-letsencrypt-domain ".$user." ".$v_domain." 'no' 'yes'", $output, $return_var);
+        exec (HESTIA_CMD."v-delete-letsencrypt-domain ".$user." ".$v_domain." ' ' 'yes'", $output, $return_var);
         check_return_code($return_var,$output);
         unset($output);
         $v_ssl_crt = '';

+ 2 - 2
web/edit/web/index.php

@@ -339,7 +339,7 @@ if (!empty($_POST['save'])) {
 
     // Delete Lets Encrypt support
     if (( $v_letsencrypt == 'yes' ) && (empty($_POST['v_letsencrypt'])) && (empty($_SESSION['error_msg']))) {
-        exec (HESTIA_CMD."v-delete-letsencrypt-domain ".$user." ".$v_domain." 'no'", $output, $return_var);
+        exec (HESTIA_CMD."v-delete-letsencrypt-domain ".$user." ".$v_domain." ''", $output, $return_var);
         check_return_code($return_var,$output);
         unset($output);
         $v_ssl_crt = '';
@@ -369,7 +369,7 @@ if (!empty($_POST['save'])) {
     // Add Lets Encrypt support
     if ((!empty($_POST['v_ssl'])) && ( $v_letsencrypt == 'no' ) && (!empty($_POST['v_letsencrypt'])) && empty($_SESSION['error_msg'])) {
         $l_aliases = str_replace("\n", ',', $v_aliases);
-        exec (HESTIA_CMD."v-add-letsencrypt-domain ".$user." ".$v_domain." '".$l_aliases."' 'no'", $output, $return_var);
+        exec (HESTIA_CMD."v-add-letsencrypt-domain ".$user." ".$v_domain." '".$l_aliases."' ''", $output, $return_var);
         check_return_code($return_var,$output);
         unset($output);
         $v_letsencrypt = 'yes';

+ 1 - 1
web/templates/admin/edit_mail_acc.html

@@ -205,7 +205,7 @@
                         </tr>
                         <?
                             list($http_host, $port) = explode(':', $_SERVER["HTTP_HOST"].":");
-                            $webmail = "http://mail.".$http_host."/";
+                            $webmail = "http://webmail.".$http_host."/";
                             if (!empty($_SESSION['MAIL_URL'])) $webmail = $_SESSION['MAIL_URL'];
                         ?>
                         <tr>

+ 2 - 2
web/templates/admin/list_mail.html

@@ -14,7 +14,7 @@
               <td class="step-right">
                 <?
                   list($http_host, $port) = explode(':', $_SERVER["HTTP_HOST"].":");
-                  $webmail = "http://mail.".$http_host."/";
+                  $webmail = "http://webmail.".$http_host."/";
                   if (!empty($_SESSION['MAIL_URL'])) $webmail = $_SESSION['MAIL_URL'];
                 ?>
                 <a class="vst" href="<?=$webmail?>" target="_blank"><?=__('open webmail')?> <i></i></a>
@@ -81,7 +81,7 @@
 
       <?
         list($http_host, $port) = explode(':', $_SERVER["HTTP_HOST"].":");
-        $webmail = "http://mail.".$http_host."/";
+        $webmail = "http://webmail.".$http_host."/";
         if (!empty($_SESSION['MAIL_URL'])) $webmail = $_SESSION['MAIL_URL'];
 
         foreach ($data as $key => $value) {

+ 1 - 4
web/templates/admin/list_mail_acc.html

@@ -13,7 +13,7 @@
               <td class="step-right">
                 <?
                   list($http_host, $port) = explode(':', $_SERVER["HTTP_HOST"].":");
-                  $webmail = "http://mail.".$http_host."/";
+                  $webmail = "http://webmail.".$http_host."/";
                   if (!empty($_SESSION['MAIL_URL'])) $webmail = $_SESSION['MAIL_URL'];
                 ?>
                 <a class="vst" href="<?=$webmail?>" target="_blank"><?=__('open webmail')?> <i></i></a>
@@ -56,9 +56,6 @@
     <div class="l-separator"></div>
     <!-- /.l-separator -->
     <div class="l-center units animated fadeIn">
-        <div class="l-unit header">
-            <div class="subtitle"><?=__('Listing')?>  <?=htmlentities($_GET['domain'])?></div>
-        </div>
         <div class="l-unit header">
             <div class="l-unit__col l-unit__col--left clearfix">
               <div class="text-center jump-small-top"></div>