Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,19 @@ RUN postconf -e virtual_uid_maps=static:5000 && \
postconf -e virtual_alias_maps=mysql:/etc/postfix/mysql-virtual-alias-maps.cf,mysql:/etc/postfix/mysql-email2email.cf && \
postconf -e virtual_transport=dovecot && \
postconf -e dovecot_destination_recipient_limit=1 && \
postconf -e 'smtpd_sasl_type = dovecot' && \
postconf -e 'smtpd_sasl_auth_enable = yes' && \
postconf -e 'smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination' && \
postconf -e 'smtpd_sasl_path = private/auth' && \
postconf -e "smtpd_client_message_rate_limit = 4" && \
postconf -e "smtpd_tls_auth_only = yes" && \
# specially for docker
postconf -F '*/*/chroot = n'
postconf -F '*/*/chroot = n' && \

RUN echo "dovecot unix - n n - - pipe" >> /etc/postfix/master.cf && \
echo ' flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -d ${recipient}' >> /etc/postfix/master.cf
echo ' flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -d ${user}@${nexthop}' >> /etc/postfix/master.cf && \
sed -i -e '/^#submission/,/^#smtps/{s/#subm/subm/;s/^# / /;/$mua/d}' /etc/postfix/master.cf && \
sed -i -e "/^!include auth-system.conf.ext$/d" /etc/dovecot/conf.d/10-auth.conf

ADD start.sh /start.sh

Expand Down
2 changes: 1 addition & 1 deletion dovecot/dovecot-sql.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
driver = mysql
connect = host={{DB_HOST}} dbname={{DB_NAME}} user={{DB_USER}} password={{DB_PASSWORD}}
default_pass_scheme = PLAIN-MD5
default_pass_scheme = PLAIN
password_query = SELECT email as user, password FROM mail_view_users WHERE email='%u';
2 changes: 1 addition & 1 deletion dovecot/local.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
protocols = imap pop3
disable_plaintext_auth = no

mail_location = maildir:/home/vmail/%d
mail_location = maildir:/home/vmail/%d/%n/Maildir

auth_default_realm = {{APP_HOST}}
auth_verbose = yes
Expand Down
7 changes: 6 additions & 1 deletion start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ sed -i "s/{{DB_NAME}}/$DB_NAME/g" /etc/dovecot/dovecot-sql.conf
sed -i "s/{{DB_PASSWORD}}/$DB_PASSWORD/g" /etc/dovecot/dovecot-sql.conf

sed -i "s/{{APP_HOST}}/$APP_HOST/g" /etc/dovecot/local.conf
postconf -e myhostname="$APP_HOST"

[ -z ${MYNETWORKS+x} ] || postconf -e "`postconf mynetworks` $MYNETWORKS"
[ -z ${RELAYHOST+x} ] || postconf -e "relayhost = $RELAYHOST"
mkdir /run/dovecot
chmod -R +r /run/dovecot
chmod -R +w /run/dovecot
Expand All @@ -56,4 +59,6 @@ rsyslogd

# run Postfix and Dovecot
postfix start
dovecot -F
dovecot
tail -f /var/log/mail.log