install_postfix_advanced.sh: (Re)add support for postgrey daemon.
This commit is contained in:
parent
74c57d33ed
commit
6f3ae84cac
@ -12,6 +12,10 @@ _TLS_KEY_FILE="${_TLS_CERT_DIR}/mailserver.key"
|
||||
_TLS_CA_FILE=/etc/ssl/certs/ca-certificates.crt
|
||||
|
||||
postfix_master_cf="/etc/postfix/master.cf"
|
||||
postfix_spool_dir="/var/spool/postfix"
|
||||
|
||||
postgrey_socket_dir="${postfix_spool_dir}/postgrey"
|
||||
postgrey_socket_file="${postgrey_socket_dir}/postgrey.sock"
|
||||
|
||||
|
||||
tmp_err_msg=$(mktemp)
|
||||
@ -492,7 +496,7 @@ else
|
||||
fi
|
||||
|
||||
|
||||
if [[ "$os_dist" = "debian" ]] && [[ $os_version -lt 10 ]] ; then
|
||||
if [[ "$os_dist" = "debian" ]] && [[ $os_version -ne 10 ]] ; then
|
||||
## - Install Postgrey from debian packages system
|
||||
## -
|
||||
echononl " Install Postgrey from debian packages system"
|
||||
@ -510,7 +514,15 @@ if [[ "$os_dist" = "debian" ]] && [[ $os_version -lt 10 ]] ; then
|
||||
fi
|
||||
|
||||
echononl " Adjust /etc/default/postgrey"
|
||||
perl -i -n -p -e "s#^(\s*)(POSTGREY_OPTS=.*)#\#\1\2\nPOSTGREY_OPTS=\"--inet=10023 --delay=149 --auto-whitelist-clients=3 --lookup-by-subnet\"#" \
|
||||
|
||||
# postgrey as tcp/ip socket
|
||||
#
|
||||
#perl -i -n -p -e "s#^(\s*)(POSTGREY_OPTS=.*)#\#\1\2\nPOSTGREY_OPTS=\"--inet=127.0.0.1:10023 --delay=149 --auto-whitelist-clients=3 --lookup-by-subnet\"#" \
|
||||
# /etc/default/postgrey > $tmp_err_msg 2>&1
|
||||
|
||||
# postgrey as unix socket
|
||||
#
|
||||
perl -i -n -p -e "s#^(\s*)(POSTGREY_OPTS=.*)#\#\1\2\nPOSTGREY_OPTS=\"--unix=/var/spool/postfix/postgrey/postgrey.sock --delay=149 --auto-whitelist-clients=3 --lookup-by-subnet\"#" \
|
||||
/etc/default/postgrey > $tmp_err_msg 2>&1
|
||||
if [[ $? -eq 0 ]] ; then
|
||||
echo_ok
|
||||
@ -536,6 +548,44 @@ EOF
|
||||
echo_failed
|
||||
fi
|
||||
|
||||
echononl " Create the Postgrey socket directory in Postfix's work aerea.."
|
||||
if [[ -d "${postgrey_socket_dir}" ]]; then
|
||||
echo_skipped
|
||||
else
|
||||
mkdir "${postgrey_socket_dir}" > /dev/null 2> $tmp_err_msg
|
||||
if [[ $? -eq 0 ]] ; then
|
||||
echo_ok
|
||||
else
|
||||
echo_failed
|
||||
error "$(cat $tmp_err_msg)"
|
||||
|
||||
echononl "\tcontinue anyway [yes/no]: "
|
||||
read OK
|
||||
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||
echononl "Wrong entry! - repeat [yes/nno]: "
|
||||
read OK
|
||||
done
|
||||
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
echononl " Enable Postgrey service at boot time.."
|
||||
if $systemd_exists ; then
|
||||
systemctl enable networking >/dev/null 2> $tmp_err_msg
|
||||
if [[ $? -eq 0 ]] ; then
|
||||
echo_ok
|
||||
else
|
||||
echo_failed
|
||||
error "$(cat $tmp_err_msg)"
|
||||
fi
|
||||
else
|
||||
echo_skipped
|
||||
warn "Skipped this step because systemd service was not found."
|
||||
fi
|
||||
|
||||
|
||||
echononl " Restart postrey daemon"
|
||||
if $systemd_exists ; then
|
||||
systemctl restart postgrey > /dev/null 2> $tmp_err_msg
|
||||
@ -555,7 +605,8 @@ EOF
|
||||
fi
|
||||
fi
|
||||
|
||||
postgrey_socket=""
|
||||
postgrey_socket="postgrey/postgrey.sock"
|
||||
#postgrey_additional_options="postgrey_time_limit = 3600"
|
||||
postgrey_additional_options=""
|
||||
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user