install_postfix_advanced.sh: fix some errors.

This commit is contained in:
Christoph 2022-09-26 01:39:03 +02:00
parent a277586090
commit 6eb955b34e

View File

@ -126,6 +126,7 @@ trap clean_up SIGHUP SIGINT SIGTERM
DEFAULT_ADMIN_EMAIL="argus@oopen.de"
DEFAULT_IS_RELAY_HOST=false
DEFAULT_IS_SYMPA_LIST_SERVER=no
DEFAULT_SASL_AUTH_ENABLED=no
# - Is this a systemd system?
@ -136,8 +137,6 @@ else
systemd_exists=true
fi
echo ""
# - Detect OS - Set variable
# - os_dist
@ -153,12 +152,27 @@ if [[ -f "$conf_file" ]]; then
fi
[[ -z "$_ADMIN_EMAIL" ]] && _ADMIN_EMAIL="$DEFAULT_ADMIN_EMAIL"
[[ -z "$_IS_SYMPA_LIST_SERVER" ]] && _IS_SYMPA_LIST_SERVER="$DEFAULT_IS_SYMPA_LIST_SERVER"
[[ -z "$_IS_RELAY_HOST" ]] && _IS_RELAY_HOST=$DEFAULT_IS_RELAY_HOST
[[ -z "$_SASL_AUTH_ENABLED" ]] && _SASL_AUTH_ENABLED="$DEFAULT_SASL_AUTH_ENABLED"
if [[ -z "$_SYMPA_LIST_SERVER" ]] ; then
_IS_SYMPA_LIST_SERVER=false
else
_IS_SYMPA_LIST_SERVER="$_SYMPA_LIST_SERVER"
fi
if [[ -z "$_RELAY_HOST" ]]; then
_IS_RELAY_HOST=$DEFAULT_IS_RELAY_HOST
else
_IS_RELAY_HOST="$_RELAY_HOST"
fi
echo ""
echo "_IS_RELAY_HOST: $_IS_RELAY_HOST"
echo ""
echo ""
echo ""
echo ""
# -------------
# --- Set default values for some non existent variables (i.e. no configuration file is present)
@ -171,7 +185,7 @@ if [[ -z "$_HOSTNAME" ]] ; then
fi
#clear
clear
echo -e "\033[21G\033[32mInstallation script for Postfix basic mailsystem \033[m"
echo
@ -269,8 +283,6 @@ echo -e "\033[32m--\033[m"
echo ""
echo "How will this Mailserver be used?"
echo ""
echo "_IS_RELAY_HOST: $_IS_RELAY_HOST"
echo ""
if [[ -n "$_IS_RELAY_HOST" ]]; then
if $_IS_RELAY_HOST ; then
echo "[1] Complete Mailserver (with mailboxes)"
@ -316,36 +328,8 @@ while [[ "$IS_RELAY_HOST" != "true" && "$IS_RELAY_HOST" != "false" ]];do
esac
done
SASL_AUTH_ENABLED="no"
if $IS_RELAY_HOST ; then
SASL_AUTH_ENABLED=""
echo ""
echo -e "\033[32m--\033[m"
echo ""
echo "Should this mail relay server support Cyrus SASL authentication?"
echo ""
while [[ "$SASL_AUTH_ENABLED" != "yes" && "$SASL_AUTH_ENABLED" != "no" ]];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
IS_SYMPA_LIST_SERVER=""
echo ""
echo -e "\033[32m--\033[m"
@ -356,7 +340,7 @@ if $IS_RELAY_HOST ; then
echononl "Sympa List Server? [$_IS_SYMPA_LIST_SERVER]: "
read IS_SYMPA_LIST_SERVER
if [[ -z "${IS_SYMPA_LIST_SERVER}" ]] ; then
IS_SYMPA_LIST_SERVER=false
IS_SYMPA_LIST_SERVER="$_IS_SYMPA_LIST_SERVER"
fi
IS_SYMPA_LIST_SERVER=${IS_SYMPA_LIST_SERVER,,}
@ -376,10 +360,41 @@ if $IS_RELAY_HOST ; then
if [[ "$IS_SYMPA_LIST_SERVER" = 'yes' || "$IS_SYMPA_LIST_SERVER" = 'true' ]] ; then
IS_SYMPA_LIST_SERVER=true
SASL_AUTH_ENABLED=yes
else
IS_SYMPA_LIST_SERVER=false
fi
if [[ -z "$SASL_AUTH_ENABLED" ]]; then
echo ""
echo -e "\033[32m--\033[m"
echo ""
echo "Should this mail relay server support Cyrus SASL authentication?"
echo ""
while [[ "$SASL_AUTH_ENABLED" != "yes" && "$SASL_AUTH_ENABLED" != "no" ]];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
fi
else
IS_SYMPA_LIST_SERVER=false
fi
@ -456,7 +471,7 @@ _HOSTNAME=$HOSTNAME
_IPV4=$IPV4
_IPV6=$IPV6
_ADMIN_EMAIL=$ADMIN_EMAIL
_IS_RELAY_HOST=$IS_RELAY_HOST
_RELAY_HOST=$IS_RELAY_HOST
EOF
if [[ $? -ne 0 ]]; then
_failed=true
@ -464,7 +479,7 @@ fi
if $IS_RELAY_HOST ; then
cat << EOF >> $conf_file
_SASL_AUTH_ENABLED=$SASL_AUTH_ENABLED
_IS_SYMPA_LIST_SERVER=$IS_SYMPA_LIST_SERVER
_SYMPA_LIST_SERVER=$IS_SYMPA_LIST_SERVER
EOF
fi
if [[ $? -ne 0 ]]; then
@ -2528,6 +2543,7 @@ milter_protocol = 6
smtpd_milters =
non_smtpd_milters = local:/opendkim/opendkim.sock
EOF
fi
echo_ok
@ -3306,7 +3322,9 @@ else
fi
echononl "\tAdd transport declaration for sympa domains to file master.cf"
SYMPA_BIN_DIR="/usr/local/sympa/bin"
SYMPA_LIBEXEC_DIR="$SYMPA_BIN_DIR"
echononl " Add transport declaration for sympa domains to file master.cf"
if $IS_SYMPA_LIST_SERVER ; then
if grep -q -e "^sympa\ " ${postfix_master_cf} 2>> /dev/null ; then