Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: xfallenduskx/dockermail
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: kenke7/dockermail
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 9 commits
  • 7 files changed
  • 4 contributors

Commits on Mar 11, 2015

  1. fix dkim keyfile

    process_settings copies the key file to /etc, not /etc/mail
    fouf committed Mar 11, 2015
    Copy the full SHA
    c52e731 View commit details
  2. Merge pull request #2 from fouf/master

    fix dkim keyfile
    Valentin Arkhipov committed Mar 11, 2015
    Copy the full SHA
    0f80459 View commit details

Commits on Mar 12, 2015

  1. Copy the full SHA
    79458fd View commit details
  2. Add missing quote

    deadaline committed Mar 12, 2015
    Copy the full SHA
    3f5a5f4 View commit details

Commits on Apr 20, 2015

  1. refine postfix conf

    Ke, Mingze committed Apr 20, 2015
    Copy the full SHA
    6367eb8 View commit details
  2. purge DKIM; replace IMAP with POP3

    Ke, Mingze committed Apr 20, 2015
    Copy the full SHA
    e426f40 View commit details
  3. add certs for dovecot

    Ke, Mingze committed Apr 20, 2015
    Copy the full SHA
    a64f7da View commit details

Commits on Apr 23, 2015

  1. set correct timezone

    Ke, Mingze committed Apr 23, 2015
    Copy the full SHA
    701fbee View commit details

Commits on Jun 5, 2016

  1. 14.10 is no longer supported

    Ke, Mingze committed Jun 5, 2016
    Copy the full SHA
    35745cc View commit details
Showing with 33 additions and 124 deletions.
  1. +10 −16 Dockerfile
  2. +2 −2 Makefile
  3. +2 −3 README.md
  4. +4 −11 config/dovecot.master
  5. +0 −68 config/example/opendkim.conf
  6. +13 −18 config/postfix.main.cf
  7. +2 −6 process_settings
26 changes: 10 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -2,21 +2,16 @@ FROM ubuntu:14.04

ENV DEBIAN_FRONTEND noninteractive
RUN locale-gen en_GB en_GB.UTF-8 && dpkg-reconfigure locales

RUN apt-get update
RUN echo "Asia/Taipei" > /etc/timezone
RUN dpkg-reconfigure tzdata

# Prerequisites
# install self-signed ssl certs
RUN apt-get install -y --force-yes ssl-cert

# Install postfix as MTA
RUN apt-get install -y --force-yes postfix

# Install dovecot as IMAP server
RUN apt-get install -y --force-yes dovecot-imapd

# Install OpenDKIM domain signing server
RUN apt-get install -y --force-yes opendkim
RUN apt-get update && apt-get install -y \
ssl-cert \
postfix \
dovecot-pop3d && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /var/tmp/* /tmp/* /var/log/* /.bash_history

# postfix configuration
ADD ./config/postfix.main.cf /etc/postfix/main.cf
@@ -43,10 +38,9 @@ ADD ./config/dovecot.imap /etc/dovecot/conf.d/20-imap.conf
# add verbose logging
#ADD ./config/dovecot.logging /etc/dovecot/conf.d/10-logging.conf

EXPOSE 25 143 587
EXPOSE 25 587 995
# todo: enable port 587 for outgoing mail, separate ports 25 and 587
# http://www.synology-wiki.de/index.php/Zusaetzliche_Ports_fuer_Postfix

# start necessary services for operation (dovecot -F starts dovecot in the foreground to prevent container exit)
ENTRYPOINT /process_settings; service rsyslog start; service opendkim start; service postfix start; dovecot -F

ENTRYPOINT /process_settings; service rsyslog start; service postfix start; dovecot -F
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ all: build
.PHONY: build

build:
docker build -t dockermail_made_special:2.1.7 .
docker build -t dockermail_made_special:2.11.1 .

run:
docker run --name dockermail -d -p 25:25 -p 587:587 -p 143:143 -v /opt/dockermail/settings:/mail_settings -v /opt/dockermail/vmail:/vmail dockermail_made_special:2.1.7
docker run --name dockermail -d -p 25:25 -p 587:587 -p 143:143 -v /opt/dockermail/settings:/mail_settings -v /opt/dockermail/vmail:/vmail dockermail_made_special:2.11.1
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -4,7 +4,6 @@ docker-made-special-mail
Based on https://github.com/lava/dockermail

A secure, minimal-configuration mail server in a docker container.

This repository is tailored to small private servers, where you own a domain and want to host your own mail.

This container uses postfix as MTA and dovecot as IMAP server.
@@ -61,6 +60,6 @@ Use the the example config files in `config/example` of this repo.
a directory on your host. (This is recommended, otherwise
you have to remember to backup your mail when you want to restart the container)

`docker run -name dockermail -d -p 25:25 -p 587:587 -p 143:143 -v /opt/dockermail/settings:/mail_settings -v /opt/dockermail/vmail:/vmail dockermail_made_special/2.1.7`
`docker run -name dockermail -d -p 25:25 -p 587:587 -p 143:143 -v /opt/dockermail/settings:/mail_settings -v /opt/dockermail/vmail:/vmail dockermail_made_special/2.11.1`

8. Enjoy!
8. Enjoy!
15 changes: 4 additions & 11 deletions config/dovecot.master
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
service imap-login {
inet_listener imap {

service pop3-login {
inet_listener pop3 {
port = 0
}

#disable imaps since we use TLS connections through the standard imap
inet_listener imaps {
port = 0
inet_listener pop3s {
}
}

service imap {

}

# not sure if this is needed
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
68 changes: 0 additions & 68 deletions config/example/opendkim.conf

This file was deleted.

31 changes: 13 additions & 18 deletions config/postfix.main.cf
Original file line number Diff line number Diff line change
@@ -21,8 +21,12 @@ readme_directory = no
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# additional authentication settings
smtpd_tls_auth_only = yes
smtpd_sasl_auth_enable = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
@@ -31,11 +35,13 @@ smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
myhostname = localhost
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = /etc/mailname, localhost.localdomain, localhost
myorigin = /etc/mailname
mydestination = localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all

# SMTP configuration for incoming mail (port 25)
# Outgoing mail (port 587) configuration is specified in master.cf
@@ -55,25 +61,14 @@ smtpd_relay_restrictions = permit_auth_destination, reject

# Mail thats not for us gets filtered out by smtpd_relay_restrictions
# When the mail is for us, we just accept everything. (could add spam blocklists/user checking etc. here)
smtpd_recipient_restrictions = permit
smtpd_recipient_restrictions =
permit_sasl_authenticated,
permit_mynetworks,
reject_unauth_destination

# Delivery to dovecot
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
virtual_alias_maps = hash:/etc/postfix/virtual
virtual_mailbox_domains = /etc/postfix/virtual-mailbox-domains
virtual_mailbox_maps = hash:/etc/postfix/virtual-mailbox-maps
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1

# additional authentication settings
smtpd_tls_auth_only = yes
smtpd_sasl_auth_enable = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth

# DKIM
milter_default_action = accept
milter_protocol = 2
smtpd_milters = inet:localhost:8891
non_smtpd_milters = inet:localhost:8891
8 changes: 2 additions & 6 deletions process_settings
Original file line number Diff line number Diff line change
@@ -2,22 +2,18 @@
# First the key file
if [ -f /mail_settings/ssl-cert-snakeoil.key ]; then
cp /mail_settings/ssl-cert-snakeoil.key /etc/ssl/private/ssl-cert-snakeoil.key
cp /mail_settings/ssl-cert-snakeoil.key /etc/dovecot/private/dovecot.pem
else
cp /etc/ssl/private/ssl-cert-snakeoil.key /mail_settings/ssl-cert-snakeoil.key
fi
# Then the pem file
if [ -f /mail_settings/ssl-cert-snakeoil.pem ]; then
cp /mail_settings/ssl-cert-snakeoil.pem /etc/ssl/certs/ssl-cert-snakeoil.pem
cp /mail_settings/ssl-cert-snakeoil.pem /etc/dovecot/dovecot.pem
else
cp /etc/ssl/certs/ssl-cert-snakeoil.pem /mail_settings/ssl-cert-snakeoil.pem
fi

# Copy OpenDKIM config
cp /mail_settings/opendkim.conf /etc/opendkim.conf
cp /mail_settings/mail.private /etc/dkim.key
chown opendkim:opendkim /etc/dkim.key
chmod 600 /etc/dkim.key

if [ -f /mail_settings/myhostname ]; then
sed -i -e "s/myhostname = localhost/myhostname = $(sed 's:/:\\/:g' /mail_settings/myhostname)/" /etc/postfix/main.cf
echo $(sed 's:/:\\/:g' /mail_settings/myhostname) > /etc/mailname