mirror of
https://git.myvelabs.com/docker/myvemail.git
synced 2025-12-18 07:46:18 +00:00
Update build/run/docker-entrypoint/init.d/30-postfix.sh
This commit is contained in:
parent
13064e802f
commit
b68154e6a5
1 changed files with 41 additions and 14 deletions
|
|
@ -30,32 +30,54 @@ then
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Whitelist
|
# Whitelist Primary and Backup mail servers
|
||||||
addmx=(${MYVEMAIL_DOMAIN})
|
addmx=(${MYVEMAIL_DOMAIN})
|
||||||
addmx+=(${MYVEMAIL_ADDMX//,/ })
|
addmx+=(${MYVEMAIL_ADDMX//,/ })
|
||||||
echo | tee /etc/postfix/{helo_access,whitelist_incoming,blacklist_incoming} >/dev/null
|
echo -n | tee /etc/postfix/{helo_access,whitelist_{domains,emails},blacklist_{domains,emails}} >/dev/null
|
||||||
for domain in ${addmx[@]}
|
for domain in ${addmx[@]}
|
||||||
do
|
do
|
||||||
echo "${domain} OK Primary and backup mail servers" | tee -a /etc/postfix/{helo_access,whitelist_incoming} >/dev/null
|
echo "${domain} OK Primary and backup mail servers" | tee -a /etc/postfix/helo_access >/dev/null
|
||||||
|
echo "/${domain}/ OK Primary and backup mail servers" | tee -a /etc/postfix/whitelisted_domains >/dev/null
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ ${MYVEMAIL_WHITELIST} ]
|
# Whitelist domains or server IP addresses
|
||||||
|
if [ ${MYVEMAIL_WHITELIST_DOMAINS} ]
|
||||||
then
|
then
|
||||||
echo >>/etc/postfix/whitelist_incoming
|
echo >>/etc/postfix/whitelisted_domains
|
||||||
addwhitelist+=(${MYVEMAIL_WHITELIST//,/ })
|
addwhitelist_domain+=(${MYVEMAIL_WHITELIST_DOMAINS//,/ })
|
||||||
for whitelist in ${addwhitelist[@]}
|
for whitelist_domain in ${addwhitelist_domain[@]}
|
||||||
do
|
do
|
||||||
echo "${whitelist} OK Whitelisted address" | tee -a /etc/postfix/whitelist_incoming >/dev/null
|
echo "/${whitelist_domain}/ OK Whitelisted domain" | tee -a /etc/postfix/whitelisted_domains >/dev/null
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Blacklist
|
# Whitelist emails
|
||||||
if [ ${MYVEMAIL_BLACKLIST} ]
|
if [ ${MYVEMAIL_WHITELIST_EMAILS} ]
|
||||||
then
|
then
|
||||||
addblacklist+=(${MYVEMAIL_BLACKLIST//,/ })
|
addwhitelist_email+=(${MYVEMAIL_WHITELIST_EMAILS//,/ })
|
||||||
for blacklist in ${addblacklist[@]}
|
for whitelist_email in ${addwhitelist_email[@]}
|
||||||
do
|
do
|
||||||
echo "${blacklist} REJECT Blacklisted address" | tee -a /etc/postfix/blacklist_incoming >/dev/null
|
echo "${whitelist_email} OK Whitelisted email" | tee -a /etc/postfix/whitelisted_emails >/dev/null
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Blacklist domains or server IP addresses
|
||||||
|
if [ ${MYVEMAIL_BLACKLIST_DOMAINS} ]
|
||||||
|
then
|
||||||
|
addblacklist_domain+=(${MYVEMAIL_BLACKLIST_DOMAINS//,/ })
|
||||||
|
for blacklist_domain in ${addblacklist_domain[@]}
|
||||||
|
do
|
||||||
|
echo "/${blacklist_domain}/ OK Blacklisted domain" | tee -a /etc/postfix/blacklisted_domains >/dev/null
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Blacklist emails
|
||||||
|
if [ ${MYVEMAIL_BLACKLIST_EMAILS} ]
|
||||||
|
then
|
||||||
|
addblacklist_email+=(${MYVEMAIL_BLACKLIST_EMAILS//,/ })
|
||||||
|
for blacklist_email in ${addblacklist_email[@]}
|
||||||
|
do
|
||||||
|
echo "${blacklist_email} OK Blacklisted email" | tee -a /etc/postfix/blacklisted_emails >/dev/null
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -70,4 +92,9 @@ setfacl -R -m u:postfix:rx /etc/postfix/sql/
|
||||||
|
|
||||||
# Start postfix
|
# Start postfix
|
||||||
postfix start
|
postfix start
|
||||||
postmap /etc/postfix/helo_access /etc/postfix/whitelist_incoming /etc/postfix/blacklist_incoming /etc/postfix/smtp_header_checks /etc/postfix/header_checks /etc/postfix/body_checks /etc/postfix/postscreen_access.cidr
|
postmap /etc/postfix/helo_access \
|
||||||
|
/etc/postfix/whitelisted_domains /etc/postfix/whitelisted_emails \
|
||||||
|
/etc/postfix/blacklisted_domains /etc/postfix/blacklisted_emails \
|
||||||
|
/etc/postfix/smtp_header_checks /etc/postfix/header_checks \
|
||||||
|
/etc/postfix/body_checks \
|
||||||
|
/etc/postfix/postscreen_access.cidr
|
||||||
Loading…
Add table
Add a link
Reference in a new issue