mirror of
https://git.myvelabs.com/docker/myvemail.git
synced 2025-12-17 21:46:17 +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
|
||||
fi
|
||||
|
||||
# Whitelist
|
||||
# Whitelist Primary and Backup mail servers
|
||||
addmx=(${MYVEMAIL_DOMAIN})
|
||||
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[@]}
|
||||
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
|
||||
|
||||
if [ ${MYVEMAIL_WHITELIST} ]
|
||||
# Whitelist domains or server IP addresses
|
||||
if [ ${MYVEMAIL_WHITELIST_DOMAINS} ]
|
||||
then
|
||||
echo >>/etc/postfix/whitelist_incoming
|
||||
addwhitelist+=(${MYVEMAIL_WHITELIST//,/ })
|
||||
for whitelist in ${addwhitelist[@]}
|
||||
echo >>/etc/postfix/whitelisted_domains
|
||||
addwhitelist_domain+=(${MYVEMAIL_WHITELIST_DOMAINS//,/ })
|
||||
for whitelist_domain in ${addwhitelist_domain[@]}
|
||||
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
|
||||
fi
|
||||
|
||||
# Blacklist
|
||||
if [ ${MYVEMAIL_BLACKLIST} ]
|
||||
# Whitelist emails
|
||||
if [ ${MYVEMAIL_WHITELIST_EMAILS} ]
|
||||
then
|
||||
addblacklist+=(${MYVEMAIL_BLACKLIST//,/ })
|
||||
for blacklist in ${addblacklist[@]}
|
||||
addwhitelist_email+=(${MYVEMAIL_WHITELIST_EMAILS//,/ })
|
||||
for whitelist_email in ${addwhitelist_email[@]}
|
||||
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
|
||||
fi
|
||||
|
||||
|
|
@ -70,4 +92,9 @@ setfacl -R -m u:postfix:rx /etc/postfix/sql/
|
|||
|
||||
# Start postfix
|
||||
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