Skip to content

Commit 099d31a

Browse files
authored
Fix issue with exim + lookup in /etc/hosts (hestiacp#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
1 parent e2d7eb9 commit 099d31a

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

install/deb/exim/exim4.conf.4.94.template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#CLAMD = yes
1010

1111
smtp_banner = $smtp_active_hostname
12-
smtp_active_hostname = ${lookup dnsdb{ptr=$interface_address}{$value}{$primary_hostname}}
12+
smtp_active_hostname = ${lookup dnsdb{>: ptr=$interface_address}{${listextract{1}{$value}}}{$primary_hostname}}
1313
add_environment = <; PATH=/bin:/usr/bin
1414
keep_environment =
1515
disable_ipv6 = true
@@ -345,7 +345,7 @@ smtp_relay_smtp:
345345

346346
remote_smtp:
347347
driver = smtp
348-
helo_data = ${lookup dnsdb{ptr=$sending_ip_address}{$value}{$primary_hostname}}
348+
helo_data = ${lookup dnsdb{>: ptr=$sending_ip_address}{${listextract{1}{$value}}}{$primary_hostname}}
349349
dkim_domain = DKIM_DOMAIN
350350
dkim_selector = mail
351351
dkim_private_key = DKIM_PRIVATE_KEY

install/deb/exim/exim4.conf.template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#CLAMD = yes
1010

1111
smtp_banner = $smtp_active_hostname
12-
smtp_active_hostname = ${lookup dnsdb{ptr=$interface_address}{$value}{$primary_hostname}}
12+
smtp_active_hostname = ${lookup dnsdb{>: ptr=$interface_address}{${listextract{1}{$value}}}{$primary_hostname}}
1313
add_environment = <; PATH=/bin:/usr/bin
1414
keep_environment =
1515
disable_ipv6 = true
@@ -345,7 +345,7 @@ smtp_relay_smtp:
345345

346346
remote_smtp:
347347
driver = smtp
348-
helo_data = ${lookup dnsdb{ptr=$sending_ip_address}{$value}{$primary_hostname}}
348+
helo_data = ${lookup dnsdb{>: ptr=$sending_ip_address}{${listextract{1}{$value}}}{$primary_hostname}}
349349
dkim_domain = DKIM_DOMAIN
350350
dkim_selector = mail
351351
dkim_private_key = DKIM_PRIVATE_KEY

install/upgrade/versions/1.5.0.sh

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,29 @@ if [ -n "$DB_PMA_ALIAS" ]; then
2727
rm /etc/apache2/conf.d/phpmyadmin.conf
2828
touch /etc/apache2/conf.d/phpmyadmin.inc
2929
fi
30+
$HESTIA/bin/v-change-sys-db-alias 'pma' "$DB_PMA_ALIAS"
31+
fi
32+
33+
if [ -n "$DB_PGA_ALIAS" ]; then
3034
if [ -e "/etc/apache2/conf.d/phppgadmin.conf" ]; then
3135
rm /etc/apache2/conf.d/phppgadmin.conf
3236
touch /etc/apache2/conf.d/phppgadmin.inc
3337
fi
3438
$HESTIA/bin/v-change-sys-db-alias 'pga' "$DB_PGA_ALIAS"
35-
$HESTIA/bin/v-change-sys-db-alias 'pma' "$DB_PMA_ALIAS"
39+
3640
fi
3741

3842
if [ -n "$MAIL_SYSTEM" ]; then
39-
43+
echo "[ ! ] Update Exim config"
4044
if [ -f "/etc/exim4/exim4.conf.template" ]; then
41-
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
42-
43-
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
45+
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
46+
47+
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
48+
49+
# When 1.5.0 beta was installed
50+
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
51+
52+
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
4453
fi
4554

4655
# Clean up legacy mailhelo file

0 commit comments

Comments
 (0)