Simplified configurations

This commit is contained in:
Thomas VIAL 2015-03-29 14:07:56 +02:00
parent 45b1d1e583
commit 9cd746ef33
3 changed files with 10 additions and 6 deletions

View file

@ -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
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 apt-get autoclean
# Configures Saslauthd
@ -12,6 +12,10 @@ RUN rm -rf /var/run/saslauthd && ln -s /var/spool/postfix/var/run/saslauthd /var
RUN adduser postfix sasl
RUN echo 'NAME="saslauthd"\nSTART=yes\nMECHANISMS="sasldb"\nTHREADS=0\nPWDIR=/var/spool/postfix/var/run/saslauthd\nPIDFILE="${PWDIR}/saslauthd.pid"\nOPTIONS="-n 0 -r -m /var/spool/postfix/var/run/saslauthd"' > /etc/default/saslauthd
# Configures Courier
RUN sed -i -r 's/daemons=5/daemons=0/g' /etc/courier/authdaemonrc
RUN sed -i -r 's/authmodulelist="authpam"/authmodulelist="authuserdb"/g' /etc/courier/authdaemonrc
# Enables Spamassassin and CRON updates
RUN sed -i -r 's/^(CRON|ENABLED)=0/\1=1/g' /etc/default/spamassassin
@ -19,10 +23,8 @@ RUN sed -i -r 's/^(CRON|ENABLED)=0/\1=1/g' /etc/default/spamassassin
RUN sed -i -r 's/#(@| \\%)bypass/\1bypass/g' /etc/amavis/conf.d/15-content_filter_mode
RUN adduser clamav amavis
RUN adduser amavis clamav
# RUN echo "/dev/shm /var/lib/amavis tmpfs defaults,noexec,nodev,nosuid,size=150m,mode=750,uid=$(id -u amavis),gid=$(id -g clamav) 0 0" >> /etc/fstab
# Enables Clamav
RUN mkdir -p /var/log/clamav && chown -R clamav:root /var/log/clamav
RUN (crontab -l ; echo "0 1 * * * /usr/bin/freshclam --quiet") | sort - | uniq - | crontab -
RUN freshclam

View file

@ -3,6 +3,7 @@
A fullstack but simple mail server (smtp, imap, antispam, antivirus...)
Includes:
- postfix
- courier-imap
- spamassasin
@ -23,6 +24,7 @@ Only config files, no *sql database required.
mail:
build: .
# or use 'image: tvial/docker-mailserver'
hostname: mail
domainname: my-domain.com
ports:
@ -31,9 +33,7 @@ Only config files, no *sql database required.
- "587:587"
- "993:993"
volumes:
- ./configs/courier:/etc/courier
- ./configs/postfix:/etc/postfix
- ./configs/spamassassin:/etc/spamassassin
environment:
docker_mail_domain: "my-domain.com"
# format is user@domain.tld|clear_password

View file

@ -31,11 +31,13 @@ postmap /etc/postfix/virtual
echo "Fixing permissions"
chown -R 5000:5000 /var/mail
mkdir -p /var/log/clamav && chown -R clamav:root /var/log/clamav
echo "Creating /etc/mailname"
echo $docker_mail_domain > /etc/mailname
echo "Starting daemons"
/etc/init.d/rsyslog start
/etc/init.d/fam start
/etc/init.d/saslauthd start
/etc/init.d/courier-authdaemon start
@ -48,5 +50,5 @@ echo "Starting daemons"
echo "Listing SASL users"
sasldblistusers2
echo "Starting supervisord"
echo "Starting..."
tail -f /var/log/mail.log