2015-03-28 14:59:15 +00:00
|
|
|
FROM ubuntu:14.04
|
|
|
|
MAINTAINER Thomas VIAL
|
|
|
|
|
|
|
|
# Packages
|
2015-07-16 17:35:11 +00:00
|
|
|
RUN apt-get update -q --fix-missing
|
2015-03-28 14:59:15 +00:00
|
|
|
RUN apt-get -y upgrade
|
2016-01-20 15:41:34 +00:00
|
|
|
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install vim postfix sasl2-bin courier-imap courier-imap-ssl \
|
2016-01-26 11:56:26 +00:00
|
|
|
courier-pop courier-pop-ssl courier-authdaemon supervisor gamin amavisd-new spamassassin clamav clamav-daemon libnet-dns-perl libmail-spf-perl \
|
2016-01-20 15:41:34 +00:00
|
|
|
pyzor razor arj bzip2 cabextract cpio file gzip nomarch p7zip pax unzip zip zoo rsyslog mailutils netcat \
|
2016-02-08 22:47:42 +00:00
|
|
|
opendkim opendkim-tools opendmarc curl
|
2015-11-20 16:31:47 +00:00
|
|
|
RUN apt-get autoclean && rm -rf /var/lib/apt/lists/*
|
2015-03-28 14:59:15 +00:00
|
|
|
|
|
|
|
# Configures Saslauthd
|
|
|
|
RUN rm -rf /var/run/saslauthd && ln -s /var/spool/postfix/var/run/saslauthd /var/run/saslauthd
|
|
|
|
RUN adduser postfix sasl
|
2016-01-12 00:02:47 +00:00
|
|
|
RUN echo 'NAME="saslauthd"\nSTART=yes\nMECHANISMS="sasldb"\nTHREADS=0\nPWDIR=/var/spool/postfix/var/run/saslauthd\nPIDFILE="${PWDIR}/saslauthd.pid"\nOPTIONS="-n 0 -c -m /var/spool/postfix/var/run/saslauthd"' > /etc/default/saslauthd
|
2015-03-28 14:59:15 +00:00
|
|
|
|
2015-03-29 12:07:56 +00:00
|
|
|
# Configures Courier
|
2015-11-22 00:48:19 +00:00
|
|
|
RUN sed -i -r 's/daemons=5/daemons=1/g' /etc/courier/authdaemonrc
|
2015-03-29 12:07:56 +00:00
|
|
|
RUN sed -i -r 's/authmodulelist="authpam"/authmodulelist="authuserdb"/g' /etc/courier/authdaemonrc
|
|
|
|
|
2015-03-28 14:59:15 +00:00
|
|
|
# Enables Spamassassin and CRON updates
|
|
|
|
RUN sed -i -r 's/^(CRON|ENABLED)=0/\1=1/g' /etc/default/spamassassin
|
|
|
|
|
|
|
|
# Enables Amavis
|
|
|
|
RUN sed -i -r 's/#(@| \\%)bypass/\1bypass/g' /etc/amavis/conf.d/15-content_filter_mode
|
|
|
|
RUN adduser clamav amavis
|
|
|
|
RUN adduser amavis clamav
|
2015-09-12 08:54:30 +00:00
|
|
|
RUN useradd -u 5000 -d /home/docker -s /bin/bash -p $(echo docker | openssl passwd -1 -stdin) docker
|
2015-03-28 14:59:15 +00:00
|
|
|
|
|
|
|
# Enables Clamav
|
2015-07-01 12:10:04 +00:00
|
|
|
RUN chmod 644 /etc/clamav/freshclam.conf
|
2015-03-28 14:59:15 +00:00
|
|
|
RUN (crontab -l ; echo "0 1 * * * /usr/bin/freshclam --quiet") | sort - | uniq - | crontab -
|
|
|
|
RUN freshclam
|
|
|
|
|
2016-01-20 15:41:34 +00:00
|
|
|
# Configure DKIM (opendkim)
|
|
|
|
RUN mkdir -p /etc/opendkim/keys
|
|
|
|
ADD postfix/TrustedHosts /etc/opendkim/TrustedHosts
|
|
|
|
# DKIM config files
|
|
|
|
ADD postfix/opendkim.conf /etc/opendkim.conf
|
|
|
|
ADD postfix/default-opendkim /etc/default/opendkim
|
|
|
|
|
2016-01-26 17:26:50 +00:00
|
|
|
# Configure DMARC (opendmarc)
|
|
|
|
ADD postfix/opendmarc.conf /etc/opendmarc.conf
|
|
|
|
ADD postfix/default-opendmarc /etc/default/opendmarc
|
|
|
|
|
2015-03-31 15:27:54 +00:00
|
|
|
# Configures Postfix
|
|
|
|
ADD postfix/main.cf /etc/postfix/main.cf
|
|
|
|
ADD postfix/master.cf /etc/postfix/master.cf
|
|
|
|
ADD postfix/sasl/smtpd.conf /etc/postfix/sasl/smtpd.conf
|
2015-08-18 11:13:08 +00:00
|
|
|
ADD bin/generate-ssl-certificate /usr/local/bin/generate-ssl-certificate
|
|
|
|
RUN chmod +x /usr/local/bin/generate-ssl-certificate
|
2015-03-31 15:27:54 +00:00
|
|
|
|
2016-02-08 22:47:42 +00:00
|
|
|
# Get LetsEncrypt signed certificate
|
|
|
|
RUN curl https://letsencrypt.org/certs/lets-encrypt-x1-cross-signed.pem > /etc/ssl/certs/lets-encrypt-x1-cross-signed.pem
|
|
|
|
RUN curl https://letsencrypt.org/certs/lets-encrypt-x2-cross-signed.pem > /etc/ssl/certs/lets-encrypt-x2-cross-signed.pem
|
|
|
|
|
2015-03-28 14:59:15 +00:00
|
|
|
# Start-mailserver script
|
|
|
|
ADD start-mailserver.sh /usr/local/bin/start-mailserver.sh
|
|
|
|
RUN chmod +x /usr/local/bin/start-mailserver.sh
|
|
|
|
|
2016-01-08 16:52:06 +00:00
|
|
|
# SMTP ports
|
|
|
|
EXPOSE 25
|
|
|
|
EXPOSE 587
|
|
|
|
|
|
|
|
# IMAP ports
|
|
|
|
EXPOSE 143
|
|
|
|
EXPOSE 993
|
|
|
|
|
2016-01-23 22:51:09 +00:00
|
|
|
# POP3 ports
|
|
|
|
EXPOSE 110
|
|
|
|
EXPOSE 995
|
|
|
|
|
2016-01-08 16:52:06 +00:00
|
|
|
CMD /usr/local/bin/start-mailserver.sh
|