Add SPF whitelist

This commit is contained in:
myve 2025-03-17 09:56:15 +00:00
commit 74d85e6b94

View file

@ -34,19 +34,27 @@ fi
addmx=(${MYVEMAIL_DOMAIN})
addmx+=(${MYVEMAIL_ADDMX//,/ })
echo -n | tee /etc/postfix/{helo_access,{whitelisted,blacklisted}_{domains,emails}} >/dev/null
# echo "/\.outbound\.protection\.outlook\.com$/ OK Outlook services" >/etc/postfix/helo_access
for domain in ${addmx[@]}
do
echo "/^${domain//./\\.}$/ OK Primary and backup mail servers" | tee -a /etc/postfix/{helo_access,whitelisted_domains} >/dev/null
done
# SPF Whitelist
if [ ${MYVEMAIL_WHITELIST_HELO} ]
then
echo >>/etc/postfix/helo_access
addwhitelist_helo=(${MYVEMAIL_WHITELIST_HELO//,/ })
for whitelist_helo in ${addwhitelist_helo[@]}
do
echo "/${whitelist_helo}/ OK Whitelisted SPF" | tee -a /etc/postfix/helo_access >/dev/null
done
fi
# Whitelist domains or server IP addresses
if [ ${MYVEMAIL_WHITELIST_DOMAINS} ]
then
echo >>/etc/postfix/whitelisted_domains
addwhitelist_domain+=(${MYVEMAIL_WHITELIST_DOMAINS//,/ })
addwhitelist_domain=(${MYVEMAIL_WHITELIST_DOMAINS//,/ })
for whitelist_domain in ${addwhitelist_domain[@]}
do
echo "/^${whitelist_domain//./\\.}$/ OK Whitelisted domain" | tee -a /etc/postfix/whitelisted_domains >/dev/null