From ccca15792069dbb2e540e74ad86c0ac71f50a053 Mon Sep 17 00:00:00 2001 From: Thomas VIAL Date: Tue, 31 Mar 2015 19:31:18 +0200 Subject: [PATCH] Added SSL for courier-imap using courier-imap-ssl. Fixed /etc/postfix/vhost issue. --- Dockerfile | 2 +- README.md | 4 +++- start-mailserver.sh | 7 +++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2bcf0c42..0086a918 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ MAINTAINER Thomas VIAL # Packages RUN apt-get update -q RUN apt-get -y upgrade -RUN DEBIAN_FRONTEND=noninteractive apt-get -y install postfix sasl2-bin courier-imap courier-authdaemon supervisor libfam0 fam amavisd-new spamassassin clamav-daemon libnet-dns-perl libmail-spf-perl pyzor razor arj bzip2 cabextract cpio file gzip nomarch pax unzip zip zoo rsyslog +RUN DEBIAN_FRONTEND=noninteractive apt-get -y install postfix sasl2-bin courier-imap courier-imap-ssl courier-authdaemon supervisor libfam0 fam amavisd-new spamassassin clamav-daemon libnet-dns-perl libmail-spf-perl pyzor razor arj bzip2 cabextract cpio file gzip nomarch pax unzip zip zoo rsyslog RUN apt-get autoclean # Configures Saslauthd diff --git a/README.md b/README.md index b138936e..159a4381 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ A fullstack but simple mail server (smtp, imap, antispam, antivirus...) Includes: - postfix with smtp auth -- courier-imap +- courier-imap with ssl support - amavis - spamassasin - clamav @@ -14,6 +14,8 @@ Additional informations: - only config files, no *sql database required - mails are stored in `/var/mail/${domain}/${username}` +- email login are full email address (`username1@my-domain.com`) +- ssl is strongly recommended ## installation diff --git a/start-mailserver.sh b/start-mailserver.sh index 4a1754b3..5a0e39bb 100644 --- a/start-mailserver.sh +++ b/start-mailserver.sh @@ -20,15 +20,17 @@ do echo "${pass}" | saslpasswd2 -p -c -u ${domain} ${login} mkdir -p /var/mail/${domain} maildirmake /var/mail/${domain}/${user} + echo ${domain} >> /tmp/vhost.tmp done < /tmp/docker_mail_users rm /tmp/docker_mail_users makeuserdb echo "Postfix configurations" -sed -i -r 's/DOCKER_MAIL_DOMAIN/$docker_mail_domain/g' /etc/postfix/main.cf postmap /etc/postfix/vmailbox -[ -f /etc/postfix/virtual ] && postmap /etc/postfix/virtual +touch /etc/postfix/virtual && postmap /etc/postfix/virtual +sed -i -r 's/DOCKER_MAIL_DOMAIN/'"$docker_mail_domain"'/g' /etc/postfix/main.cf +cat /tmp/vhost.tmp | sort | uniq >> /etc/postfix/vhost && rm /tmp/vhost.tmp echo "Fixing permissions" chown -R 5000:5000 /var/mail @@ -43,6 +45,7 @@ echo "Starting daemons" /etc/init.d/saslauthd start /etc/init.d/courier-authdaemon start /etc/init.d/courier-imap start +/etc/init.d/courier-imap-ssl start /etc/init.d/spamassassin start /etc/init.d/clamav-daemon start /etc/init.d/amavis start