mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
Dockerfile cleanup (#665)
This commit is contained in:
parent
88e3d88de1
commit
af8b1657ab
81
Dockerfile
81
Dockerfile
|
@ -8,9 +8,7 @@ ENV ONE_DIR=0
|
||||||
# Packages
|
# Packages
|
||||||
RUN apt-get update -q --fix-missing && \
|
RUN apt-get update -q --fix-missing && \
|
||||||
apt-get -y upgrade && \
|
apt-get -y upgrade && \
|
||||||
apt-get -y install postfix
|
apt-get -y install postfix && \
|
||||||
RUN apt-get update -q --fix-missing && \
|
|
||||||
apt-get -y upgrade && \
|
|
||||||
apt-get -y install --no-install-recommends \
|
apt-get -y install --no-install-recommends \
|
||||||
amavisd-new \
|
amavisd-new \
|
||||||
arj \
|
arj \
|
||||||
|
@ -54,27 +52,38 @@ RUN apt-get update -q --fix-missing && \
|
||||||
&& \
|
&& \
|
||||||
curl https://packages.elasticsearch.org/GPG-KEY-elasticsearch | apt-key add - && \
|
curl https://packages.elasticsearch.org/GPG-KEY-elasticsearch | apt-key add - && \
|
||||||
echo "deb http://packages.elastic.co/beats/apt stable main" | tee -a /etc/apt/sources.list.d/beats.list && \
|
echo "deb http://packages.elastic.co/beats/apt stable main" | tee -a /etc/apt/sources.list.d/beats.list && \
|
||||||
apt-get update -q --fix-missing && apt-get -y upgrade fail2ban filebeat && \
|
apt-get update -q --fix-missing && \
|
||||||
apt-get autoclean && rm -rf /var/lib/apt/lists/* && \
|
apt-get -y upgrade \
|
||||||
rm -rf /usr/share/locale/* && rm -rf /usr/share/man/* && rm -rf /usr/share/doc/* && \
|
fail2ban \
|
||||||
touch /var/log/auth.log && update-locale
|
filebeat \
|
||||||
|
&& \
|
||||||
|
apt-get autoclean && \
|
||||||
|
rm -rf /var/lib/apt/lists/* && \
|
||||||
|
rm -rf /usr/share/locale/* && \
|
||||||
|
rm -rf /usr/share/man/* && \
|
||||||
|
rm -rf /usr/share/doc/* && \
|
||||||
|
touch /var/log/auth.log && \
|
||||||
|
update-locale
|
||||||
|
|
||||||
# Enables Clamav
|
# Enables Clamav
|
||||||
RUN (echo "0 0,6,12,18 * * * /usr/bin/freshclam --quiet" ; crontab -l) | crontab -
|
RUN (echo "0 0,6,12,18 * * * /usr/bin/freshclam --quiet" ; crontab -l) | crontab - && \
|
||||||
RUN chmod 644 /etc/clamav/freshclam.conf && freshclam
|
chmod 644 /etc/clamav/freshclam.conf && \
|
||||||
|
freshclam
|
||||||
|
|
||||||
# Configures Dovecot
|
# Configures Dovecot
|
||||||
RUN sed -i -e 's/include_try \/usr\/share\/dovecot\/protocols\.d/include_try \/etc\/dovecot\/protocols\.d/g' /etc/dovecot/dovecot.conf
|
COPY target/dovecot/auth-passwdfile.inc target/dovecot/??-*.conf /etc/dovecot/conf.d/
|
||||||
RUN sed -i -e 's/#mail_plugins = \$mail_plugins/mail_plugins = \$mail_plugins sieve/g' /etc/dovecot/conf.d/15-lda.conf
|
RUN sed -i -e 's/include_try \/usr\/share\/dovecot\/protocols\.d/include_try \/etc\/dovecot\/protocols\.d/g' /etc/dovecot/dovecot.conf && \
|
||||||
RUN sed -i -e 's/^.*lda_mailbox_autocreate.*/lda_mailbox_autocreate = yes/g' /etc/dovecot/conf.d/15-lda.conf
|
sed -i -e 's/#mail_plugins = \$mail_plugins/mail_plugins = \$mail_plugins sieve/g' /etc/dovecot/conf.d/15-lda.conf && \
|
||||||
RUN sed -i -e 's/^.*lda_mailbox_autosubscribe.*/lda_mailbox_autosubscribe = yes/g' /etc/dovecot/conf.d/15-lda.conf
|
sed -i -e 's/^.*lda_mailbox_autocreate.*/lda_mailbox_autocreate = yes/g' /etc/dovecot/conf.d/15-lda.conf && \
|
||||||
RUN sed -i -e 's/^.*postmaster_address.*/postmaster_address = '${POSTMASTER_ADDRESS:="postmaster@domain.com"}'/g' /etc/dovecot/conf.d/15-lda.conf
|
sed -i -e 's/^.*lda_mailbox_autosubscribe.*/lda_mailbox_autosubscribe = yes/g' /etc/dovecot/conf.d/15-lda.conf && \
|
||||||
RUN sed -i 's/#imap_idle_notify_interval = 2 mins/imap_idle_notify_interval = 29 mins/' /etc/dovecot/conf.d/20-imap.conf
|
sed -i -e 's/^.*postmaster_address.*/postmaster_address = '${POSTMASTER_ADDRESS:="postmaster@domain.com"}'/g' /etc/dovecot/conf.d/15-lda.conf && \
|
||||||
COPY target/dovecot/auth-passwdfile.inc /etc/dovecot/conf.d/
|
sed -i 's/#imap_idle_notify_interval = 2 mins/imap_idle_notify_interval = 29 mins/' /etc/dovecot/conf.d/20-imap.conf && \
|
||||||
COPY target/dovecot/??-*.conf /etc/dovecot/conf.d/
|
cd /usr/share/dovecot && \
|
||||||
RUN cd /usr/share/dovecot && ./mkcert.sh
|
./mkcert.sh && \
|
||||||
RUN mkdir /usr/lib/dovecot/sieve-pipe && chmod 755 /usr/lib/dovecot/sieve-pipe
|
mkdir /usr/lib/dovecot/sieve-pipe && \
|
||||||
RUN mkdir /usr/lib/dovecot/sieve-filter && chmod 755 /usr/lib/dovecot/sieve-filter
|
chmod 755 /usr/lib/dovecot/sieve-pipe && \
|
||||||
|
mkdir /usr/lib/dovecot/sieve-filter && \
|
||||||
|
chmod 755 /usr/lib/dovecot/sieve-filter
|
||||||
|
|
||||||
# Configures LDAP
|
# Configures LDAP
|
||||||
COPY target/dovecot/dovecot-ldap.conf.ext /etc/dovecot
|
COPY target/dovecot/dovecot-ldap.conf.ext /etc/dovecot
|
||||||
|
@ -86,16 +95,17 @@ RUN sed -i -r 's/^(CRON)=0/\1=1/g' /etc/default/spamassassin
|
||||||
# Enables Postgrey
|
# Enables Postgrey
|
||||||
COPY target/postgrey/postgrey /etc/default/postgrey
|
COPY target/postgrey/postgrey /etc/default/postgrey
|
||||||
COPY target/postgrey/postgrey.init /etc/init.d/postgrey
|
COPY target/postgrey/postgrey.init /etc/init.d/postgrey
|
||||||
RUN chmod 755 /etc/init.d/postgrey
|
RUN chmod 755 /etc/init.d/postgrey && \
|
||||||
RUN mkdir /var/run/postgrey
|
mkdir /var/run/postgrey && \
|
||||||
RUN chown postgrey:postgrey /var/run/postgrey
|
chown postgrey:postgrey /var/run/postgrey
|
||||||
|
|
||||||
# Enables Amavis
|
# Enables Amavis
|
||||||
RUN sed -i -r 's/#(@| \\%)bypass/\1bypass/g' /etc/amavis/conf.d/15-content_filter_mode
|
|
||||||
COPY target/amavis/conf.d/60-dms_default_config /etc/amavis/conf.d/
|
COPY target/amavis/conf.d/60-dms_default_config /etc/amavis/conf.d/
|
||||||
RUN adduser clamav amavis && adduser amavis clamav
|
RUN sed -i -r 's/#(@| \\%)bypass/\1bypass/g' /etc/amavis/conf.d/15-content_filter_mode && \
|
||||||
RUN useradd -u 5000 -d /home/docker -s /bin/bash -p $(echo docker | openssl passwd -1 -stdin) docker
|
adduser clamav amavis && \
|
||||||
RUN (echo "0 4 * * * /usr/local/bin/virus-wiper" ; crontab -l) | crontab -
|
adduser amavis clamav && \
|
||||||
|
useradd -u 5000 -d /home/docker -s /bin/bash -p $(echo docker | openssl passwd -1 -stdin) docker && \
|
||||||
|
(echo "0 4 * * * /usr/local/bin/virus-wiper" ; crontab -l) | crontab -
|
||||||
|
|
||||||
# Configure Fail2ban
|
# Configure Fail2ban
|
||||||
COPY target/fail2ban/jail.conf /etc/fail2ban/jail.conf
|
COPY target/fail2ban/jail.conf /etc/fail2ban/jail.conf
|
||||||
|
@ -104,7 +114,9 @@ RUN echo "ignoreregex =" >> /etc/fail2ban/filter.d/postfix-sasl.conf
|
||||||
|
|
||||||
# Enables Pyzor and Razor
|
# Enables Pyzor and Razor
|
||||||
USER amavis
|
USER amavis
|
||||||
RUN razor-admin -create && razor-admin -register && pyzor discover
|
RUN razor-admin -create && \
|
||||||
|
razor-admin -register && \
|
||||||
|
pyzor discover
|
||||||
USER root
|
USER root
|
||||||
|
|
||||||
# Configure DKIM (opendkim)
|
# Configure DKIM (opendkim)
|
||||||
|
@ -123,14 +135,17 @@ RUN sed -i 's/START_DAEMON=no/START_DAEMON=yes/g' /etc/default/fetchmail
|
||||||
|
|
||||||
# Configures Postfix
|
# Configures Postfix
|
||||||
COPY target/postfix/main.cf target/postfix/master.cf /etc/postfix/
|
COPY target/postfix/main.cf target/postfix/master.cf /etc/postfix/
|
||||||
RUN echo "" > /etc/aliases
|
RUN echo "" > /etc/aliases && \
|
||||||
RUN openssl dhparam -out /etc/postfix/dhparams.pem 2048
|
openssl dhparam -out /etc/postfix/dhparams.pem 2048
|
||||||
|
|
||||||
# Configuring Logs
|
# Configuring Logs
|
||||||
RUN sed -i -r "/^#?compress/c\compress\ncopytruncate" /etc/logrotate.conf && \
|
RUN sed -i -r "/^#?compress/c\compress\ncopytruncate" /etc/logrotate.conf && \
|
||||||
mkdir -p /var/log/mail && chown syslog:root /var/log/mail && \
|
mkdir -p /var/log/mail && \
|
||||||
touch /var/log/mail/clamav.log && chown -R clamav:root /var/log/mail/clamav.log && \
|
chown syslog:root /var/log/mail && \
|
||||||
touch /var/log/mail/freshclam.log && chown -R clamav:root /var/log/mail/freshclam.log && \
|
touch /var/log/mail/clamav.log && \
|
||||||
|
chown -R clamav:root /var/log/mail/clamav.log && \
|
||||||
|
touch /var/log/mail/freshclam.log && \
|
||||||
|
chown -R clamav:root /var/log/mail/freshclam.log && \
|
||||||
sed -i -r 's|/var/log/mail|/var/log/mail/mail|g' /etc/rsyslog.d/50-default.conf && \
|
sed -i -r 's|/var/log/mail|/var/log/mail/mail|g' /etc/rsyslog.d/50-default.conf && \
|
||||||
sed -i -r 's|;auth,authpriv.none|;mail.none;mail.error;auth,authpriv.none|g' /etc/rsyslog.d/50-default.conf && \
|
sed -i -r 's|;auth,authpriv.none|;mail.none;mail.error;auth,authpriv.none|g' /etc/rsyslog.d/50-default.conf && \
|
||||||
sed -i -r 's|LogFile /var/log/clamav/|LogFile /var/log/mail/|g' /etc/clamav/clamd.conf && \
|
sed -i -r 's|LogFile /var/log/clamav/|LogFile /var/log/mail/|g' /etc/clamav/clamd.conf && \
|
||||||
|
|
Loading…
Reference in a new issue