install_amavis.sh: fix error in writing 'master.cf' in case of SASL AUTH enabled.

This commit is contained in:
Christoph 2023-11-21 21:03:14 +01:00
parent d5d3bddb8c
commit e595f034d8
2 changed files with 43 additions and 0 deletions

View File

@ -6,6 +6,8 @@ _HOSTNAME=
_IPV4=
_IPV6=
_SASL_AUTH_ENABLED=no
_QUARANTINE_DIR=/var/QUARANTINE
_QUARANTINE_ADMIN=postmaster\@$mydomain

View File

@ -110,6 +110,8 @@ detect_os_1 () {
# --- Some default settings
# -------------
DEFAULT_SASL_AUTH_ENABLED="no"
DEFAULT_QUARANTINE_DIR="/var/QUARANTINE"
DEFAULT_QUARANTINE_ADMIN='postmaster\@$mydomain'
DEFAULT_DB_IN_USE=false
@ -162,6 +164,8 @@ if [[ -z "$_HOSTNAME" ]] ; then
[[ "$_HOSTNAME" = "$_HOSTNAME_SHORT" ]] && _HOSTNAME=""
fi
[[ -z "$_SASL_AUTH_ENABLED" ]] && _SASL_AUTH_ENABLED="$DEFAULT_SASL_AUTH_ENABLED"
[[ -z "$_QUARANTINE_DIR" ]] && _QUARANTINE_DIR="$DEFAULT_QUARANTINE_DIR"
@ -334,6 +338,33 @@ if [ "X$IPV6" = "Xnone" -o "X$IPV6" = "XNone" ]; then
IPV6=disabled
fi
SASL_AUTH_ENABLED=
echo ""
echo -e "\033[32m--\033[m"
echo ""
echo "Should this mail server support Cyrus SASL authentication?"
echo ""
while [[ "$SASL_AUTH_ENABLED" != "yes" && "$SASL_AUTH_ENABLED" != "yes" ]];do
if [[ -n "$_SASL_AUTH_ENABLED" ]]; then
echononl "Support Cyrus SASL authentication [${_SASL_AUTH_ENABLED}]: "
read SASL_AUTH_ENABLED
SASL_AUTH_ENABLED=${SASL_AUTH_ENABLED,,}
[[ -z "$SASL_AUTH_ENABLED" ]] && SASL_AUTH_ENABLED="$_SASL_AUTH_ENABLED"
else
echononl "Support Cyrus SASL authentication [yes/no]: "
read SASL_AUTH_ENABLED
SASL_AUTH_ENABLED=${SASL_AUTH_ENABLED,,}
fi
if [[ "$SASL_AUTH_ENABLED" != "yes" && "$SASL_AUTH_ENABLED" != "no" ]] ; then
_SASL_AUTH_ENABLED=""
echo -e "\n\t\033[33m\033[1mWrong entry!\033[m\n Type 'yes' or 'no'"
fi
done
echo ""
echo -e "\033[32m--\033[m"
@ -788,6 +819,9 @@ echo ""
echo -e "\tHostname...............................: $HOSTNAME"
echo -e "\tIPv4 address...........................: $IPV4"
echo -e "\tIPv6 address...........................: $IPV6"
echo ""
echo -e "\tSASL AUTH support......................: $SASL_AUTH_ENABLED"
echo ""
echo -e "\tQuarantine Directory ..................: $QUARANTINE_DIR"
echo ""
echo -e "\tInstall ClamAv Unoffical Sigs .........: $INSTALL_CLAMAV_UNOFFICIAL_SIGS"
@ -837,6 +871,8 @@ _HOSTNAME=$HOSTNAME
_IPV4=$IPV4
_IPV6=$IPV6
_SASL_AUTH_ENABLED=$SASL_AUTH_ENABLED
_QUARANTINE_DIR=$QUARANTINE_DIR
_QUARANTINE_ADMIN=$QUARANTINE_ADMIN
@ -4937,8 +4973,13 @@ while IFS='' read -r _line || [[ -n $_line ]] ; do
smtp 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
if ! $submission_present && ! $smtps_present && ! $localhost_10025_present ; then
cat >> $postfix_master_cf << EOF
localhost:10025 inet n - y - - smtpd