From 9cd746ef333ac9b3d73ab5db5dcecff684ee1000 Mon Sep 17 00:00:00 2001 From: Thomas VIAL Date: Sun, 29 Mar 2015 14:07:56 +0200 Subject: [PATCH] Simplified configurations --- Dockerfile | 8 +++++--- README.md | 4 ++-- start-mailserver.sh | 4 +++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index f56e32a3..83e651fd 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 +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 diff --git a/README.md b/README.md index ed66435c..1f9d001d 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/start-mailserver.sh b/start-mailserver.sh index 01d816f5..900d2b3f 100644 --- a/start-mailserver.sh +++ b/start-mailserver.sh @@ -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 \ No newline at end of file