Browse Source

Fix issue with exim + lookup in /etc/hosts (#2236)

* Fix issue with exim + lookup in /etc/hosts

@cmstew for most of the work

* Add upgrade script

* Include message

* Fix error in sed command 

Replace helo_data with smtp_active_hostname line by accident

* Add extra 2 spaces
Jaap Marcus 4 years ago
parent
commit
099d31ae93

+ 2 - 2
install/deb/exim/exim4.conf.4.94.template

@@ -9,7 +9,7 @@
 #CLAMD = yes
 
 smtp_banner = $smtp_active_hostname
-smtp_active_hostname = ${lookup dnsdb{ptr=$interface_address}{$value}{$primary_hostname}}
+smtp_active_hostname = ${lookup dnsdb{>: ptr=$interface_address}{${listextract{1}{$value}}}{$primary_hostname}}
 add_environment = <; PATH=/bin:/usr/bin
 keep_environment =
 disable_ipv6 = true
@@ -345,7 +345,7 @@ smtp_relay_smtp:
 
 remote_smtp:
   driver = smtp
-  helo_data = ${lookup dnsdb{ptr=$sending_ip_address}{$value}{$primary_hostname}}
+  helo_data = ${lookup dnsdb{>: ptr=$sending_ip_address}{${listextract{1}{$value}}}{$primary_hostname}}
   dkim_domain = DKIM_DOMAIN
   dkim_selector = mail
   dkim_private_key = DKIM_PRIVATE_KEY

+ 2 - 2
install/deb/exim/exim4.conf.template

@@ -9,7 +9,7 @@
 #CLAMD = yes
 
 smtp_banner = $smtp_active_hostname
-smtp_active_hostname = ${lookup dnsdb{ptr=$interface_address}{$value}{$primary_hostname}}
+smtp_active_hostname = ${lookup dnsdb{>: ptr=$interface_address}{${listextract{1}{$value}}}{$primary_hostname}}
 add_environment = <; PATH=/bin:/usr/bin
 keep_environment =
 disable_ipv6 = true
@@ -345,7 +345,7 @@ smtp_relay_smtp:
 
 remote_smtp:
   driver = smtp
-  helo_data = ${lookup dnsdb{ptr=$sending_ip_address}{$value}{$primary_hostname}}
+  helo_data = ${lookup dnsdb{>: ptr=$sending_ip_address}{${listextract{1}{$value}}}{$primary_hostname}}
   dkim_domain = DKIM_DOMAIN
   dkim_selector = mail
   dkim_private_key = DKIM_PRIVATE_KEY

+ 14 - 5
install/upgrade/versions/1.5.0.sh

@@ -27,20 +27,29 @@ if [ -n "$DB_PMA_ALIAS" ]; then
       rm /etc/apache2/conf.d/phpmyadmin.conf
       touch /etc/apache2/conf.d/phpmyadmin.inc
    fi
+   $HESTIA/bin/v-change-sys-db-alias 'pma' "$DB_PMA_ALIAS"
+fi
+
+if [ -n "$DB_PGA_ALIAS" ]; then
    if [ -e "/etc/apache2/conf.d/phppgadmin.conf" ]; then
       rm /etc/apache2/conf.d/phppgadmin.conf
       touch /etc/apache2/conf.d/phppgadmin.inc
    fi
    $HESTIA/bin/v-change-sys-db-alias 'pga' "$DB_PGA_ALIAS"
-   $HESTIA/bin/v-change-sys-db-alias 'pma' "$DB_PMA_ALIAS"
+
 fi
 
 if [ -n "$MAIL_SYSTEM" ]; then
-
+   echo "[ ! ] Update Exim config"
     if [ -f "/etc/exim4/exim4.conf.template" ]; then
-        sed -i 's/^smtp_active_hostname = \${if exists {\/etc\/exim4\/mailhelo\.conf}{\${lookup{\$interface_address}lsearch{\/etc\/exim4\/mailhelo\.conf}{\$value}{\$primary_hostname}}}{\$primary_hostname}}$/smtp_active_hostname = \${lookup dnsdb{ptr=\$interface_address}{\$value}{\$primary_hostname}}/' /etc/exim4/exim4.conf.template
-    
-        sed -i 's/^  helo_data = \${if exists {\/etc\/exim4\/mailhelo\.conf}{\${lookup{\$sending_ip_address}lsearch{\/etc\/exim4\/mailhelo\.conf}{\$value}{\$primary_hostname}}}{\$primary_hostname}}$/  helo_data = \${lookup dnsdb{ptr=\$sending_ip_address}{\$value}{\$primary_hostname}}/' /etc/exim4/exim4.conf.template
+        sed -i 's/^smtp_active_hostname = \${if exists {\/etc\/exim4\/mailhelo\.conf}{\${lookup{\$interface_address}lsearch{\/etc\/exim4\/mailhelo\.conf}{\$value}{\$primary_hostname}}}{\$primary_hostname}}$/smtp_active_hostname = \${lookup dnsdb{>: ptr=\$interface_address}{\${listextract{1}{\$value}}}{\$primary_hostname}}/' /etc/exim4/exim4.conf.template
+                
+        sed -i 's/^  helo_data = \${if exists {\/etc\/exim4\/mailhelo\.conf}{\${lookup{\$sending_ip_address}lsearch{\/etc\/exim4\/mailhelo\.conf}{\$value}{\$primary_hostname}}}{\$primary_hostname}}$/  helo_data = \${lookup dnsdb{>: ptr=\$sending_ip_address}{\${listextract{1}{\$value}}}{\$primary_hostname}}/' /etc/exim4/exim4.conf.template
+        
+        # When 1.5.0 beta was installed
+        sed -i 's/^smtp_active_hostname = \${lookup dnsdb{ptr=\$interface_address}{\$value}{\$primary_hostname}}$/smtp_active_hostname = \${lookup dnsdb{>: ptr=\$interface_address}{\${listextract{1}{\$value}}}{\$primary_hostname}}/' /etc/exim4/exim4.conf.template
+            
+         sed -i 's/^  helo_data = \${lookup dnsdb{ptr=\$sending_ip_address}{\$value}{\$primary_hostname}}$/  helo_data = \${lookup dnsdb{>: ptr=\$sending_ip_address}{\${listextract{1}{\$value}}}{\$primary_hostname}}/' /etc/exim4/exim4.conf.template
     fi
     
     # Clean up legacy mailhelo file