2016-01-20 15:41:34 +00:00
#!/bin/bash
2015-03-28 14:59:15 +00:00
2015-08-26 08:04:07 +00:00
die ( ) {
echo >& 2 " $@ "
exit 1
}
2015-08-18 11:13:08 +00:00
2016-04-11 22:04:33 +00:00
#
# Users
#
if [ -f /tmp/docker-mailserver/postfix-accounts.cf ] ; then
2016-04-25 14:00:39 +00:00
echo "Checking file line endings"
sed -i 's/\r//g' /tmp/docker-mailserver/postfix-accounts.cf
2015-08-26 08:04:07 +00:00
echo "Regenerating postfix 'vmailbox' and 'virtual' for given users"
2016-04-11 22:04:33 +00:00
echo "# WARNING: this file is auto-generated. Modify config/postfix-accounts.cf to edit user list." > /etc/postfix/vmailbox
2015-08-18 11:13:08 +00:00
2016-04-11 22:04:33 +00:00
# Checking that /tmp/docker-mailserver/postfix-accounts.cf ends with a newline
sed -i -e '$a\' /tmp/docker-mailserver/postfix-accounts.cf
2016-04-07 12:20:51 +00:00
# Configuring Dovecot
echo -n > /etc/dovecot/userdb
chown dovecot:dovecot /etc/dovecot/userdb
chmod 640 /etc/dovecot/userdb
cp -a /usr/share/dovecot/protocols.d /etc/dovecot/
# Disable pop3 (it will be eventually enabled later in the script, if requested)
mv /etc/dovecot/protocols.d/pop3d.protocol /etc/dovecot/protocols.d/pop3d.protocol.disab
2016-04-29 13:24:10 +00:00
mv /etc/dovecot/protocols.d/managesieved.protocol /etc/dovecot/protocols.d/managesieved.protocol.disab
2016-04-07 12:20:51 +00:00
sed -i -e 's/#ssl = yes/ssl = yes/g' /etc/dovecot/conf.d/10-master.conf
sed -i -e 's/#port = 993/port = 993/g' /etc/dovecot/conf.d/10-master.conf
sed -i -e 's/#port = 995/port = 995/g' /etc/dovecot/conf.d/10-master.conf
sed -i -e 's/#ssl = yes/ssl = required/g' /etc/dovecot/conf.d/10-ssl.conf
2015-08-26 08:04:07 +00:00
# Creating users
2016-04-11 22:04:33 +00:00
# 'pass' is encrypted
2015-08-26 08:04:07 +00:00
while IFS = $'|' read login pass
do
# Setting variables for better readability
user = $( echo ${ login } | cut -d @ -f1)
domain = $( echo ${ login } | cut -d @ -f2)
# Let's go!
echo " user ' ${ user } ' for domain ' ${ domain } ' with password '********' "
echo " ${ login } ${ domain } / ${ user } / " >> /etc/postfix/vmailbox
2016-04-11 22:04:33 +00:00
# User database for dovecot has the following format:
2016-04-07 12:20:51 +00:00
# user:password:uid:gid:(gecos):home:(shell):extra_fields
2016-04-11 22:04:33 +00:00
# Example :
# ${login}:${pass}:5000:5000::/var/mail/${domain}/${user}::userdb_mail=maildir:/var/mail/${domain}/${user}
2016-04-07 12:20:51 +00:00
echo " ${ login } : ${ pass } :5000:5000::/var/mail/ ${ domain } / ${ user } :: " >> /etc/dovecot/userdb
2015-08-26 08:04:07 +00:00
mkdir -p /var/mail/${ domain }
2016-01-15 23:54:51 +00:00
if [ ! -d " /var/mail/ ${ domain } / ${ user } " ] ; then
2016-04-07 12:20:51 +00:00
maildirmake.dovecot " /var/mail/ ${ domain } / ${ user } "
maildirmake.dovecot " /var/mail/ ${ domain } / ${ user } /.Sent "
maildirmake.dovecot " /var/mail/ ${ domain } / ${ user } /.Trash "
maildirmake.dovecot " /var/mail/ ${ domain } / ${ user } /.Drafts "
echo -e "INBOX\nSent\nTrash\nDrafts" >> " /var/mail/ ${ domain } / ${ user } /subscriptions "
2016-02-11 13:00:59 +00:00
touch " /var/mail/ ${ domain } / ${ user } /.Sent/maildirfolder "
2015-12-08 00:59:45 +00:00
fi
2016-04-28 22:41:48 +00:00
# Copy user provided sieve file, if present
test -e /tmp/docker-mailserver/${ login } .dovecot.sieve && cp /tmp/docker-mailserver/${ login } .dovecot.sieve /var/mail/${ domain } /${ user } /.dovecot.sieve
2016-04-20 23:08:14 +00:00
echo ${ domain } >> /tmp/vhost.tmp
2016-04-13 19:43:15 +00:00
done < /tmp/docker-mailserver/postfix-accounts.cf
2015-08-26 08:04:07 +00:00
else
2016-04-11 22:04:33 +00:00
echo "==> Warning: 'config/docker-mailserver/postfix-accounts.cf' is not provided. No mail account created."
2015-08-26 08:04:07 +00:00
fi
2016-04-11 22:04:33 +00:00
#
# Aliases
#
if [ -f /tmp/docker-mailserver/postfix-virtual.cf ] ; then
2015-08-26 08:04:07 +00:00
# Copying virtual file
2016-04-11 22:04:33 +00:00
cp /tmp/docker-mailserver/postfix-virtual.cf /etc/postfix/virtual
while read from to
2015-10-14 14:50:57 +00:00
do
# Setting variables for better readability
2016-04-08 14:48:52 +00:00
uname = $( echo ${ from } | cut -d @ -f1)
2015-10-14 14:50:57 +00:00
domain = $( echo ${ from } | cut -d @ -f2)
2016-04-08 14:48:52 +00:00
# if they are equal it means the line looks like: "user1 other@domain.tld"
2016-04-20 23:08:14 +00:00
test " $uname " != " $domain " && echo ${ domain } >> /tmp/vhost.tmp
2016-04-11 22:04:33 +00:00
done < /tmp/docker-mailserver/postfix-virtual.cf
2015-08-26 08:04:07 +00:00
else
2016-04-11 22:04:33 +00:00
echo "==> Warning: 'config/postfix-virtual.cf' is not provided. No mail alias/forward created."
2015-08-26 08:04:07 +00:00
fi
2016-05-23 02:10:58 +00:00
if [ -f /tmp/docker-mailserver/postfix-regexp.cf ] ; then
# Copying regexp alias file
echo "Adding regexp alias file postfix-regexp.cf"
cp /tmp/docker-mailserver/postfix-regexp.cf /etc/postfix/regexp
2016-05-23 06:35:09 +00:00
sed -i -e ' /^virtual_alias_maps/{
s/ regexp:.*//
s/$/ regexp:\/ etc\/ postfix\/ regexp/
} ' /etc/postfix/main.cf
2016-05-23 02:10:58 +00:00
fi
2015-08-07 07:19:38 +00:00
2016-01-23 17:38:21 +00:00
# DKIM
2016-04-07 12:20:51 +00:00
# Check if keys are already available
2016-04-11 22:04:33 +00:00
if [ -e "/tmp/docker-mailserver/opendkim/KeyTable" ] ; then
2016-04-07 12:20:51 +00:00
mkdir -p /etc/opendkim
2016-04-11 22:04:33 +00:00
cp -a /tmp/docker-mailserver/opendkim/* /etc/opendkim/
2016-04-19 21:25:54 +00:00
echo "DKIM keys added for: `ls -C /etc/opendkim/keys/`"
2016-04-24 15:37:10 +00:00
echo "Changing permissions on /etc/opendkim"
# chown entire directory
chown -R opendkim:opendkim /etc/opendkim/
# And make sure permissions are right
chmod -R 0700 /etc/opendkim/keys/
2016-04-20 21:01:32 +00:00
else
echo "No DKIM key provided. Check the documentation to find how to get your keys."
2016-04-07 12:20:51 +00:00
fi
2016-01-23 17:38:21 +00:00
2016-01-26 17:26:50 +00:00
# DMARC
2016-04-07 12:20:51 +00:00
# if there is no AuthservID create it
2016-01-26 18:03:12 +00:00
if [ ` cat /etc/opendmarc.conf | grep -w AuthservID | wc -l` -eq 0 ] ; then
2016-01-28 11:00:31 +00:00
echo " AuthservID $( hostname) " >> /etc/opendmarc.conf
2016-01-26 17:26:50 +00:00
fi
2016-01-26 18:03:12 +00:00
if [ ` cat /etc/opendmarc.conf | grep -w TrustedAuthservIDs | wc -l` -eq 0 ] ; then
2016-01-28 11:00:31 +00:00
echo " TrustedAuthservIDs $( hostname) " >> /etc/opendmarc.conf
2016-01-26 17:26:50 +00:00
fi
if [ ! -f "/etc/opendmarc/ignore.hosts" ] ; then
mkdir -p /etc/opendmarc/
echo "localhost" >> /etc/opendmarc/ignore.hosts
fi
2015-12-05 15:44:13 +00:00
# SSL Configuration
2016-04-24 15:37:10 +00:00
case $SSL_TYPE in
2015-12-05 15:44:13 +00:00
"letsencrypt" )
# letsencrypt folders and files mounted in /etc/letsencrypt
2016-04-05 09:53:20 +00:00
if [ -e " /etc/letsencrypt/live/ $( hostname) /cert.pem " ] \
&& [ -e " /etc/letsencrypt/live/ $( hostname) /chain.pem " ] \
2016-04-26 17:39:08 +00:00
&& [ -e " /etc/letsencrypt/live/ $( hostname) /fullchain.pem " ] \
2016-04-05 09:53:20 +00:00
&& [ -e " /etc/letsencrypt/live/ $( hostname) /privkey.pem " ] ; then
echo " Adding $( hostname) SSL certificate "
# create combined.pem from (cert|chain|privkey).pem with eol after each .pem
2016-04-08 22:27:33 +00:00
sed -e '$a\' -s /etc/letsencrypt/live/$( hostname) /{ cert,chain,privkey} .pem > /etc/letsencrypt/live/$( hostname) /combined.pem
2015-12-05 15:44:13 +00:00
# Postfix configuration
sed -i -r 's/smtpd_tls_cert_file=\/etc\/ssl\/certs\/ssl-cert-snakeoil.pem/smtpd_tls_cert_file=\/etc\/letsencrypt\/live\/' $( hostname) '\/fullchain.pem/g' /etc/postfix/main.cf
sed -i -r 's/smtpd_tls_key_file=\/etc\/ssl\/private\/ssl-cert-snakeoil.key/smtpd_tls_key_file=\/etc\/letsencrypt\/live\/' $( hostname) '\/privkey.pem/g' /etc/postfix/main.cf
2016-04-07 12:20:51 +00:00
# Dovecot configuration
sed -i -e 's/ssl_cert = <\/etc\/dovecot\/dovecot\.pem/ssl_cert = <\/etc\/letsencrypt\/live\/' $( hostname) '\/fullchain\.pem/g' /etc/dovecot/conf.d/10-ssl.conf
sed -i -e 's/ssl_key = <\/etc\/dovecot\/private\/dovecot\.pem/ssl_key = <\/etc\/letsencrypt\/live\/' $( hostname) '\/privkey\.pem/g' /etc/dovecot/conf.d/10-ssl.conf
2016-01-23 22:51:09 +00:00
2016-04-26 17:39:08 +00:00
echo "SSL configured with 'letsencrypt' certificates"
2015-12-05 15:44:13 +00:00
2016-04-05 09:53:20 +00:00
fi
2015-12-05 15:44:13 +00:00
; ;
2016-02-27 16:16:28 +00:00
"custom" )
# Adding CA signed SSL certificate if provided in 'postfix/ssl' folder
2016-04-18 22:30:56 +00:00
if [ -e " /tmp/docker-mailserver/ssl/ $( hostname) -full.pem " ] ; then
2016-02-27 16:16:28 +00:00
echo " Adding $( hostname) SSL certificate "
mkdir -p /etc/postfix/ssl
2016-04-18 22:30:56 +00:00
cp " /tmp/docker-mailserver/ssl/ $( hostname) -full.pem " /etc/postfix/ssl
2016-02-27 16:16:28 +00:00
# Postfix configuration
sed -i -r 's/smtpd_tls_cert_file=\/etc\/ssl\/certs\/ssl-cert-snakeoil.pem/smtpd_tls_cert_file=\/etc\/postfix\/ssl\/' $( hostname) '-full.pem/g' /etc/postfix/main.cf
sed -i -r 's/smtpd_tls_key_file=\/etc\/ssl\/private\/ssl-cert-snakeoil.key/smtpd_tls_key_file=\/etc\/postfix\/ssl\/' $( hostname) '-full.pem/g' /etc/postfix/main.cf
2016-04-07 12:20:51 +00:00
# Dovecot configuration
sed -i -e 's/ssl_cert = <\/etc\/dovecot\/dovecot\.pem/ssl_cert = <\/etc\/postfix\/ssl\/' $( hostname) '-full\.pem/g' /etc/dovecot/conf.d/10-ssl.conf
sed -i -e 's/ssl_key = <\/etc\/dovecot\/private\/dovecot\.pem/ssl_key = <\/etc\/postfix\/ssl\/' $( hostname) '-full\.pem/g' /etc/dovecot/conf.d/10-ssl.conf
2016-02-27 16:16:28 +00:00
2016-04-26 17:39:08 +00:00
echo "SSL configured with 'CA signed/custom' certificates"
2016-03-11 20:37:04 +00:00
2016-02-27 16:16:28 +00:00
fi
; ;
2015-12-05 15:44:13 +00:00
"self-signed" )
# Adding self-signed SSL certificate if provided in 'postfix/ssl' folder
2016-04-18 22:30:56 +00:00
if [ -e " /tmp/docker-mailserver/ssl/ $( hostname) -cert.pem " ] \
&& [ -e " /tmp/docker-mailserver/ssl/ $( hostname) -key.pem " ] \
&& [ -e " /tmp/docker-mailserver/ssl/ $( hostname) -combined.pem " ] \
&& [ -e "/tmp/docker-mailserver/ssl/demoCA/cacert.pem" ] ; then
2015-12-05 15:44:13 +00:00
echo " Adding $( hostname) SSL certificate "
mkdir -p /etc/postfix/ssl
2016-04-18 22:30:56 +00:00
cp " /tmp/docker-mailserver/ssl/ $( hostname) -cert.pem " /etc/postfix/ssl
cp " /tmp/docker-mailserver/ssl/ $( hostname) -key.pem " /etc/postfix/ssl
2016-04-07 12:20:51 +00:00
# Force permission on key file
chmod 600 /etc/postfix/ssl/$( hostname) -key.pem
2016-04-18 22:30:56 +00:00
cp " /tmp/docker-mailserver/ssl/ $( hostname) -combined.pem " /etc/postfix/ssl
cp /tmp/docker-mailserver/ssl/demoCA/cacert.pem /etc/postfix/ssl
2015-12-05 15:44:13 +00:00
# Postfix configuration
sed -i -r 's/smtpd_tls_cert_file=\/etc\/ssl\/certs\/ssl-cert-snakeoil.pem/smtpd_tls_cert_file=\/etc\/postfix\/ssl\/' $( hostname) '-cert.pem/g' /etc/postfix/main.cf
sed -i -r 's/smtpd_tls_key_file=\/etc\/ssl\/private\/ssl-cert-snakeoil.key/smtpd_tls_key_file=\/etc\/postfix\/ssl\/' $( hostname) '-key.pem/g' /etc/postfix/main.cf
sed -i -r 's/#smtpd_tls_CAfile=/smtpd_tls_CAfile=\/etc\/postfix\/ssl\/cacert.pem/g' /etc/postfix/main.cf
sed -i -r 's/#smtp_tls_CAfile=/smtp_tls_CAfile=\/etc\/postfix\/ssl\/cacert.pem/g' /etc/postfix/main.cf
2016-01-20 15:41:34 +00:00
ln -s /etc/postfix/ssl/cacert.pem " /etc/ssl/certs/cacert- $( hostname) .pem "
2015-12-05 15:44:13 +00:00
2016-04-07 12:20:51 +00:00
# Dovecot configuration
sed -i -e 's/ssl_cert = <\/etc\/dovecot\/dovecot\.pem/ssl_cert = <\/etc\/postfix\/ssl\/' $( hostname) '-combined\.pem/g' /etc/dovecot/conf.d/10-ssl.conf
sed -i -e 's/ssl_key = <\/etc\/dovecot\/private\/dovecot\.pem/ssl_key = <\/etc\/postfix\/ssl\/' $( hostname) '-key\.pem/g' /etc/dovecot/conf.d/10-ssl.conf
2015-12-05 15:44:13 +00:00
2016-04-26 17:39:08 +00:00
echo "SSL configured with 'self-signed' certificates"
2015-12-05 15:44:13 +00:00
2016-01-26 11:56:26 +00:00
fi
2015-12-05 15:44:13 +00:00
; ;
esac
2015-08-18 11:13:08 +00:00
2016-04-28 22:41:48 +00:00
if [ -f /tmp/vhost.tmp ] ; then
cat /tmp/vhost.tmp | sort | uniq > /etc/postfix/vhost && rm /tmp/vhost.tmp
fi
echo "Postfix configurations"
touch /etc/postfix/vmailbox && postmap /etc/postfix/vmailbox
touch /etc/postfix/virtual && postmap /etc/postfix/virtual
2016-04-11 22:04:33 +00:00
#
# Override Postfix configuration
#
if [ -f /tmp/docker-mailserver/postfix-main.cf ] ; then
2016-02-20 02:16:54 +00:00
while read line; do
postconf -e " $line "
2016-04-11 22:04:33 +00:00
done < /tmp/docker-mailserver/postfix-main.cf
echo "Loaded 'config/postfix-main.cf'"
2016-02-20 02:16:54 +00:00
else
2016-04-28 22:41:48 +00:00
echo "No extra postfix settings loaded because optional '/tmp/docker-mailserver/postfix-main.cf' not provided."
2016-02-20 02:16:54 +00:00
fi
2016-05-23 04:45:00 +00:00
# Support general SASL password
rm -f /etc/postfix/sasl_passwd
2016-02-20 02:17:14 +00:00
if [ ! -z " $SASL_PASSWD " ] ; then
2016-05-23 04:45:00 +00:00
echo " $SASL_PASSWD " >> /etc/postfix/sasl_passwd
fi
# Support outgoing email relay via Amazon SES
if [ ! -z " $AWS_SES_HOST " -a ! -z " $AWS_SES_USERPASS " ] ; then
echo " Setting up outgoing email via AWS SES host $AWS_SES_HOST "
echo " [ $AWS_SES_HOST ]:25 $AWS_SES_USERPASS " >>/etc/postfix/sasl_passwd
postconf -e \
" relayhost = [ $AWS_SES_HOST ]:25 " \
"smtp_sasl_auth_enable = yes" \
"smtp_sasl_security_options = noanonymous" \
"smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd" \
"smtp_use_tls = yes" \
"smtp_tls_security_level = encrypt" \
2016-05-23 07:03:22 +00:00
"smtp_tls_note_starttls_offer = yes" \
"smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt"
2016-05-23 04:45:00 +00:00
fi
# Install SASL passwords
if [ -f /etc/postfix/sasl_passwd ] ; then
2016-02-20 02:17:14 +00:00
postmap hash:/etc/postfix/sasl_passwd
rm /etc/postfix/sasl_passwd
chown root:root /etc/postfix/sasl_passwd.db
chmod 0600 /etc/postfix/sasl_passwd.db
2016-04-19 21:25:54 +00:00
echo "Loaded SASL_PASSWD"
2016-02-20 02:17:14 +00:00
else
2016-04-19 21:25:54 +00:00
echo "==> Warning: 'SASL_PASSWD' is not provided. /etc/postfix/sasl_passwd not created."
2016-02-20 02:17:14 +00:00
fi
2016-05-23 02:23:08 +00:00
# Fix permissions, but skip this if 3 levels deep the user id is already set
2016-05-24 03:45:58 +00:00
if [ ` find /var/mail -maxdepth 3 -a \( \! -user 5000 -o \! -group 5000 \) | grep -c .` != 0 ] ; then
2016-05-23 02:23:08 +00:00
echo "Fixing /var/mail permissions"
chown -R 5000:5000 /var/mail
else
echo "Permissions in /var/mail look OK"
fi
2015-03-28 14:59:15 +00:00
echo "Creating /etc/mailname"
2015-08-17 20:16:08 +00:00
echo $( hostname -d) > /etc/mailname
2015-03-28 14:59:15 +00:00
2015-07-04 13:54:40 +00:00
echo "Configuring Spamassassin"
2016-02-18 21:11:24 +00:00
SA_TAG = ${ SA_TAG : = "2.0" } && sed -i -r 's/^\$sa_tag_level_deflt (.*);/\$sa_tag_level_deflt = ' $SA_TAG ';/g' /etc/amavis/conf.d/20-debian_defaults
SA_TAG2 = ${ SA_TAG2 : = "6.31" } && sed -i -r 's/^\$sa_tag2_level_deflt (.*);/\$sa_tag2_level_deflt = ' $SA_TAG2 ';/g' /etc/amavis/conf.d/20-debian_defaults
SA_KILL = ${ SA_KILL : = "6.31" } && sed -i -r 's/^\$sa_kill_level_deflt (.*);/\$sa_kill_level_deflt = ' $SA_KILL ';/g' /etc/amavis/conf.d/20-debian_defaults
2016-04-18 22:30:56 +00:00
test -e /tmp/docker-mailserver/spamassassin-rules.cf && cp /tmp/docker-mailserver/spamassassin-rules.cf /etc/spamassassin/
2016-06-02 23:22:03 +00:00
if [ " $ENABLE_FAIL2BAN " = 1 ] ; then
2016-07-28 18:34:20 +00:00
echo "Fail2ban enabled"
2016-06-02 23:22:03 +00:00
test -e /tmp/docker-mailserver/fail2ban-jail.cf && cp /tmp/docker-mailserver/fail2ban-jail.cf /etc/fail2ban/jail.local
else
# Disable logrotate config for fail2ban if not enabled
rm -f /etc/logrotate.d/fail2ban
fi
2016-04-20 20:37:06 +00:00
# Fix cron.daily for spamassassin
sed -i -e 's/invoke-rc.d spamassassin reload/\/etc\/init\.d\/spamassassin reload/g' /etc/cron.daily/spamassassin
2015-07-04 13:54:40 +00:00
2016-05-24 06:21:18 +00:00
# Consolidate all state that should be persisted across container restarts into one mounted
# directory
statedir = /var/mail-state
if [ " $ONE_DIR " = 1 -a -d $statedir ] ; then
echo " Consolidating all state onto $statedir "
for d in /var/spool/postfix /var/lib/postfix /var/lib/amavis /var/lib/clamav /var/lib/spamassasin /var/lib/fail2ban; do
dest = $statedir /` echo $d | sed -e 's/.var.//; s/\//-/g' `
if [ -d $dest ] ; then
echo " Destination $dest exists, linking $d to it "
rm -rf $d
ln -s $dest $d
elif [ -d $d ] ; then
echo " Moving contents of $d to $dest : " ` ls $d `
mv $d $dest
ln -s $dest $d
else
echo " Linking $d to $dest "
mkdir -p $dest
ln -s $dest $d
fi
done
fi
2015-03-28 14:59:15 +00:00
echo "Starting daemons"
2015-08-19 13:52:50 +00:00
cron
2015-03-29 12:07:56 +00:00
/etc/init.d/rsyslog start
2016-02-29 22:52:10 +00:00
2016-04-29 13:24:10 +00:00
# Enable Managesieve service by setting the symlink
# to the configuration file Dovecot will actually find
2016-04-29 15:09:48 +00:00
if [ " $ENABLE_MANAGESIEVE " = 1 ] ; then
2016-07-28 18:35:09 +00:00
echo "Sieve management enabled"
2016-04-29 13:24:10 +00:00
mv /etc/dovecot/protocols.d/managesieved.protocol.disab /etc/dovecot/protocols.d/managesieved.protocol
fi
2016-02-29 22:52:10 +00:00
if [ " $SMTP_ONLY " != 1 ] ; then
2016-04-07 12:20:51 +00:00
# Here we are starting sasl and imap, not pop3 because it's disabled by default
echo " * Starting dovecot services"
2016-04-13 21:16:46 +00:00
/usr/sbin/dovecot -c /etc/dovecot/dovecot.conf
2016-02-29 22:52:10 +00:00
fi
2016-04-07 12:20:51 +00:00
2016-02-29 22:52:10 +00:00
if [ " $ENABLE_POP3 " = 1 -a " $SMTP_ONLY " != 1 ] ; then
2016-01-23 22:51:09 +00:00
echo "Starting POP3 services"
2016-04-07 12:20:51 +00:00
mv /etc/dovecot/protocols.d/pop3d.protocol.disab /etc/dovecot/protocols.d/pop3d.protocol
/usr/sbin/dovecot reload
2016-01-23 22:51:09 +00:00
fi
2016-05-24 17:19:06 +00:00
if [ -f /tmp/docker-mailserver/dovecot.cf ] ; then
cp /tmp/docker-mailserver/dovecot.cf /etc/dovecot/local.conf
/usr/sbin/dovecot reload
fi
2016-04-18 21:18:19 +00:00
# Start services related to SMTP
2015-03-28 14:59:15 +00:00
/etc/init.d/spamassassin start
/etc/init.d/clamav-daemon start
/etc/init.d/amavis start
2016-01-20 15:41:34 +00:00
/etc/init.d/opendkim start
2016-01-26 17:26:50 +00:00
/etc/init.d/opendmarc start
2015-03-28 14:59:15 +00:00
/etc/init.d/postfix start
2016-03-31 10:33:47 +00:00
if [ " $ENABLE_FAIL2BAN " = 1 ] ; then
echo "Starting fail2ban service"
2016-04-13 21:16:46 +00:00
touch /var/log/auth.log
2016-03-31 10:33:47 +00:00
/etc/init.d/fail2ban start
fi
2015-03-28 14:59:15 +00:00
2016-04-07 12:20:51 +00:00
echo "Listing users"
/usr/sbin/dovecot user '*'
2015-03-28 14:59:15 +00:00
2015-03-29 12:07:56 +00:00
echo "Starting..."
2016-04-01 15:18:13 +00:00
tail -f /var/log/mail/mail.log