mirror of
https://git.myvelabs.com/docker/myvemail.git
synced 2025-12-18 01:26:17 +00:00
First commit
This commit is contained in:
commit
7b58f82156
21 changed files with 1951 additions and 0 deletions
48
build/run/docker-entrypoint/init.d/30-postfix.sh
Executable file
48
build/run/docker-entrypoint/init.d/30-postfix.sh
Executable file
|
|
@ -0,0 +1,48 @@
|
|||
#!/usr/bin/env bash
|
||||
# Postfix
|
||||
echo ${MYVEMAIL_DOMAIN} >/etc/mailname
|
||||
postconf -e "myhostname = ${MYVEMAIL_SUBDOMAIN}.${MYVEMAIL_DOMAIN}"
|
||||
postconf -e "mydomain = ${MYVEMAIL_DOMAIN}"
|
||||
|
||||
# resolv.conf
|
||||
mkdir /var/spool/postfix/etc
|
||||
cp /etc/resolv.conf /var/spool/postfix/etc/resolv.conf
|
||||
|
||||
# Whitelist localhost
|
||||
sed -i "s/{{LOCAL_IPADDRESS}}/$(wget -q4O- ipv4.icanhazip.com)/" /etc/postfix/postscreen_access.cidr
|
||||
|
||||
# Configure backup mail servers
|
||||
if [ ${MYVEMAIL_BACKUPMX} ]
|
||||
then
|
||||
backupmx+=(${MYVEMAIL_BACKUPMX//,/ })
|
||||
|
||||
postconf -e "$(postconf mynetworks)$(printf ' %s/32' ${backupmx[@]})"
|
||||
postconf -e "smtp_fallback_relay =$(printf ' [%s]:25' ${backupmx[@]})"
|
||||
|
||||
# Whitelist
|
||||
for domain in ${backupmx[@]}
|
||||
do
|
||||
echo "${domain}/32 permit" >>/etc/postfix/postscreen_access.cidr
|
||||
done
|
||||
fi
|
||||
|
||||
# Whitelist
|
||||
addmx=(${MYVEMAIL_DOMAIN})
|
||||
addmx+=(${MYVEMAIL_ADDMX//,/ })
|
||||
for domain in ${addmx[@]}
|
||||
do
|
||||
echo "${domain} OK" | tee -a /etc/postfix/{helo_access,rbl_override} >/dev/null
|
||||
done
|
||||
|
||||
# Virtual mailboxes
|
||||
sed -e "s/{{MYVEMAIL_POSTFIXADMIN_DBNAME}}/${MYVEMAIL_POSTFIXADMIN_DBNAME}/" \
|
||||
-e "s/{{MYVEMAIL_POSTFIXADMIN_DBUSER}}/${MYVEMAIL_POSTFIXADMIN_DBUSER}/" \
|
||||
-e "s/{{MYVEMAIL_POSTFIXADMIN_DBPASS}}/${MYVEMAIL_POSTFIXADMIN_DBPASS}/" \
|
||||
-i /etc/postfix/sql/*.cf
|
||||
|
||||
# Permissions
|
||||
setfacl -R -m u:postfix:rx /etc/postfix/sql/
|
||||
|
||||
# Start postfix
|
||||
postfix start
|
||||
postmap /etc/postfix/helo_access /etc/postfix/rbl_override /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