Browse Source

Set webmail (+LE) ip address to same ip as the web domain

Robert Zollner 6 years ago
parent
commit
d998502346
2 changed files with 19 additions and 2 deletions
  1. 9 1
      bin/v-add-mail-domain-ssl
  2. 10 1
      bin/v-add-sys-webmail

+ 9 - 1
bin/v-add-mail-domain-ssl

@@ -40,7 +40,6 @@ source $HESTIA/conf/hestia.conf
 # Additional argument formatting
 format_domain
 format_domain_idn
-get_user_ip
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -63,6 +62,15 @@ check_hestia_demo_mode
 #                       Action                             #
 #----------------------------------------------------------#
 
+# Inherit web domain local ip address
+domain_ip=$(get_object_value 'web' 'DOMAIN' "$domain" '$IP')
+local_ip=$(get_real_ip "$domain_ip")
+if [ ! -z "$local_ip" ]; then
+    is_ip_valid "$local_ip" "$user"
+else
+    get_user_ip
+fi
+
 # Call routine to add SSL configuration to mail domain
 add_mail_ssl_config
 

+ 10 - 1
bin/v-add-sys-webmail

@@ -35,7 +35,7 @@ source $HESTIA/conf/hestia.conf
 # Additional argument formatting
 format_domain
 format_domain_idn
-get_user_ip
+
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -54,6 +54,15 @@ is_object_unsuspended 'mail' 'DOMAIN' "$domain"
 #                       Action                             #
 #----------------------------------------------------------#
 
+# Inherit web domain local ip address
+domain_ip=$(get_object_value 'web' 'DOMAIN' "$domain" '$IP')
+local_ip=$(get_real_ip "$domain_ip")
+if [ ! -z "$local_ip" ]; then
+    is_ip_valid "$local_ip" "$user"
+else
+    get_user_ip
+fi
+
 # Verify that webmail alias variable exists and create it if it does not
 if [ -z "$WEBMAIL_ALIAS" ]; then
     $BIN/v-change-sys-config-value 'WEBMAIL_ALIAS' "webmail"