install_amavis.sh,install_postfix_advanced.sh: support additional smtp port in case of relay host.

This commit is contained in:
Christoph
2025-01-27 18:50:01 +01:00
parent ee41a335b1
commit 7b6e4c36d0
2 changed files with 93 additions and 1 deletions

View File

@ -5034,6 +5034,12 @@ if grep -iq -E "^amavisfeed\s+" $postfix_master_cf > /dev/null 2>&1 ; then
else
amavisfeed_present=false
fi
if grep -iq -E "^[0-9]{2,5}\s+inet.*smtpd" $postfix_master_cf > /dev/null 2>&1 ; then
listen_on_additional_smtp_port=true
additional_smtp_port="$(grep -E "^[0-9]{2,5}\s+inet.*smtpd" /etc/postfix/master.cf | grep -o -E "^[0-9]{2,5}")"
else
listen_on_additional_smtp_port=false
fi
> $postfix_master_cf
while IFS='' read -r _line || [[ -n $_line ]] ; do
@ -5051,6 +5057,19 @@ EOF
EOF
fi
if ${listen_on_additional_smtp_port} ; then
cat >> $postfix_master_cf << EOF
${additional_smtp_port} inet n - y - - smtpd
-o smtpd_proxy_filter=127.0.0.1:10024
-o content_filter=
EOF
if [[ "$SASL_AUTH_ENABLED" = "no" ]] ; then
cat >> $postfix_master_cf << EOF
-o smtpd_sasl_auth_enable=no
EOF
fi
fi
if ! $submission_present && ! $smtps_present && ! $localhost_10025_present ; then
cat >> $postfix_master_cf << EOF
localhost:10025 inet n - y - - smtpd
@ -5305,6 +5324,13 @@ else
fi
fi
if ${listen_on_additional_smtp_port}: then
echo ""
warn "Please do not forget to allow incomming traffic on port \033[1m${additional_smtp_port}\033[m.
Check your firewall settings.."
fi
#fi # if $ommit ; then
# -------------------------------