install_postfix_advanced.sh: add support for allowing extra hosts (ip-addresses) for relaying.

This commit is contained in:
Christoph 2024-03-22 01:54:45 +01:00
parent 44317f0b57
commit ba486f22db

View File

@ -1582,6 +1582,8 @@ mynetworks =
#162.55.82.73
# d.mx.oopen.de
#95.217.204.227/32
# e.mx.oopen.de
#95.217.204.205/32
smtp_bind_address = $IPV4
#smtp_bind_address6 = $IPV6
@ -2472,6 +2474,7 @@ smtpd_relay_restrictions =
# only special accounts (postmaster, abuse and other rolr accounts)
check_recipient_access btree:/etc/postfix/access_recipient-rfc,
# White- / Blacklisting
check_client_access btree:/etc/postfix/client_allow_relay,
check_sender_access btree:/etc/postfix/access_sender,
check_recipient_access btree:/etc/postfix/access_recipient,
# permit trusted network (mynetwork)
@ -2813,6 +2816,31 @@ else
echo_failed
fi
echononl " Create file \"client_allow_relay\""
if [[ ! -f "/etc/postfix/client_allow_relay" ]]; then
cat <<EOF > /etc/postfix/client_allow_relay
# /etc/postfix/client_allow_relay
#
# Restricts which clients (IP addresses or hostnames) this system accepts
# (or rejects) for relaying e-mails
#
# Example:
# b.mx.oopen.de OK
#lists.mx.warenform.de OK
#b.mx.oopen.de OK
#d.mx.oopen.de OK
EOF
fi
postmap btree:/etc/postfix/client_allow_relay
if [[ $? -eq 0 ]] ; then
echo_ok
else
echo_failed
fi
echononl " Create file \"sender_canonical\""
if [[ ! -f /etc/postfix/sender_canonical ]]; then
cat <<EOF > /etc/postfix/sender_canonical