From 74d85e6b94a5afa0004ec1b14ebc4e66dd59c812 Mon Sep 17 00:00:00 2001 From: myve Date: Mon, 17 Mar 2025 09:56:15 +0000 Subject: [PATCH] Add SPF whitelist --- build/run/docker-entrypoint/init.d/30-postfix.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/build/run/docker-entrypoint/init.d/30-postfix.sh b/build/run/docker-entrypoint/init.d/30-postfix.sh index 8dac88a..2ef537d 100755 --- a/build/run/docker-entrypoint/init.d/30-postfix.sh +++ b/build/run/docker-entrypoint/init.d/30-postfix.sh @@ -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