Major move around
This commit is contained in:
parent
90a0de099b
commit
a56a8d917e
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Benno Evers
|
||||
Copyright (c) 2015 Valentin Arkhipov
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -1,14 +0,0 @@
|
||||
auth_mechanisms = plain login
|
||||
|
||||
passdb {
|
||||
driver = passwd-file
|
||||
args = /etc/dovecot/passwd
|
||||
}
|
||||
|
||||
|
||||
userdb {
|
||||
driver = static
|
||||
args = uid=vmail gid=vmail home=/vmail/%d/%n allow_all_users=yes
|
||||
}
|
||||
|
||||
|
@ -1,34 +0,0 @@
|
||||
service imap-login {
|
||||
inet_listener imap {
|
||||
|
||||
}
|
||||
|
||||
#disable imaps since we use TLS connections through the standard imap
|
||||
inet_listener imaps {
|
||||
port = 0
|
||||
}
|
||||
}
|
||||
|
||||
service imap {
|
||||
|
||||
}
|
||||
|
||||
# not sure if this is needed
|
||||
service lmtp {
|
||||
unix_listener /var/spool/postfix/private/dovecot-lmtp {
|
||||
group = vmail
|
||||
mode = 0660
|
||||
user = postfix
|
||||
}
|
||||
}
|
||||
|
||||
service auth {
|
||||
unix_listener /var/spool/postfix/private/auth {
|
||||
mode = 0660
|
||||
user = postfix
|
||||
group = vmail
|
||||
}
|
||||
}
|
||||
|
||||
service auth-worker {
|
||||
}
|
@ -8,7 +8,6 @@ RUN apt-get update && apt-get install -y \
|
||||
ssl-cert \
|
||||
postfix \
|
||||
dovecot-imapd \
|
||||
opendkim && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
@ -19,8 +18,8 @@ RUN cat /etc/postfix/master-additional.cf >> /etc/postfix/master.cf
|
||||
|
||||
# configure settings script
|
||||
VOLUME ["/mail_settings"]
|
||||
COPY process_settings /process_settings
|
||||
RUN chmod 755 /process_settings
|
||||
COPY boot /boot
|
||||
RUN chmod 755 /boot
|
||||
|
||||
# add user vmail who own all mail folders
|
||||
VOLUME ["/vmail"]
|
||||
@ -34,12 +33,9 @@ ADD ./config/dovecot.auth /etc/dovecot/conf.d/10-auth.conf
|
||||
ADD ./config/dovecot.master /etc/dovecot/conf.d/10-master.conf
|
||||
ADD ./config/dovecot.lda /etc/dovecot/conf.d/15-lda.conf
|
||||
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
|
||||
|
||||
# Uncomment to add verbose logging
|
||||
# ADD ./config/dovecot.logging /etc/dovecot/conf.d/10-logging.conf
|
||||
|
||||
EXPOSE 25 143 587
|
||||
# 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 /boot; service rsyslog start; service postfix start; dovecot -F
|
@ -3,21 +3,15 @@
|
||||
if [ -f /mail_settings/ssl-cert-snakeoil.key ]; then
|
||||
cp /mail_settings/ssl-cert-snakeoil.key /etc/ssl/private/ssl-cert-snakeoil.key
|
||||
else
|
||||
cp /etc/ssl/private/ssl-cert-snakeoil.key /mail_settings/ssl-cert-snakeoil.key
|
||||
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
|
||||
else
|
||||
cp /etc/ssl/certs/ssl-cert-snakeoil.pem /mail_settings/ssl-cert-snakeoil.pem
|
||||
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
|
||||
@ -27,13 +21,13 @@ fi
|
||||
cp /mail_settings/aliases /etc/postfix/virtual
|
||||
cp /mail_settings/domains /etc/postfix/virtual-mailbox-domains
|
||||
|
||||
# todo: this could probably be done in one line
|
||||
# parse mailbox settings
|
||||
mkdir /etc/postfix/tmp
|
||||
awk < /etc/postfix/virtual '{ print $2 }' > /etc/postfix/tmp/virtual-receivers
|
||||
sed -r 's,(.+)@(.+),\2/\1/,' /etc/postfix/tmp/virtual-receivers > /etc/postfix/tmp/virtual-receiver-folders
|
||||
paste /etc/postfix/tmp/virtual-receivers /etc/postfix/tmp/virtual-receiver-folders > /etc/postfix/virtual-mailbox-maps
|
||||
|
||||
# give postfix the ownership of his files
|
||||
# give postfix ownership of its files
|
||||
chown -R postfix:postfix /etc/postfix
|
||||
|
||||
# map virtual aliases and user/filesystem mappings
|
11
email_core/config/dovecot.auth
Normal file
11
email_core/config/dovecot.auth
Normal file
@ -0,0 +1,11 @@
|
||||
auth_mechanisms = plain login
|
||||
|
||||
passdb {
|
||||
driver = passwd-file
|
||||
args = /etc/dovecot/passwd
|
||||
}
|
||||
|
||||
userdb {
|
||||
driver = static
|
||||
args = uid=vmail gid=vmail home=/vmail/%d/%n allow_all_users=yes
|
||||
}
|
@ -16,4 +16,4 @@ namespace inbox {
|
||||
auto = subscribe # autocreate and autosubscribe the Sent mailbox
|
||||
special_use = \Sent
|
||||
}
|
||||
}
|
||||
}
|
33
email_core/config/dovecot.master
Normal file
33
email_core/config/dovecot.master
Normal file
@ -0,0 +1,33 @@
|
||||
service imap-login {
|
||||
inet_listener imap {
|
||||
|
||||
}
|
||||
|
||||
#disable imaps since we use TLS connections through the standard imap
|
||||
inet_listener imaps {
|
||||
port = 0
|
||||
}
|
||||
}
|
||||
|
||||
service imap {
|
||||
}
|
||||
|
||||
# not sure if this is needed
|
||||
service lmtp {
|
||||
unix_listener /var/spool/postfix/private/dovecot-lmtp {
|
||||
group = vmail
|
||||
mode = 0660
|
||||
user = postfix
|
||||
}
|
||||
}
|
||||
|
||||
service auth {
|
||||
unix_listener /var/spool/postfix/private/auth {
|
||||
mode = 0660
|
||||
user = postfix
|
||||
group = vmail
|
||||
}
|
||||
}
|
||||
|
||||
service auth-worker {
|
||||
}
|
@ -1,12 +1,11 @@
|
||||
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
|
||||
|
||||
|
||||
# Debian specific: Specifying a file name will cause the first
|
||||
# line of that file to be used as the name. The Debian default
|
||||
# is /etc/mailname.
|
||||
#myorigin = /etc/mailname
|
||||
|
||||
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
|
||||
smtpd_banner = $myhostname ESMTP $mail_name
|
||||
biff = no
|
||||
|
||||
# appending .domain is the MUA's job.
|
||||
@ -27,12 +26,11 @@ smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
|
||||
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
|
||||
# information on enabling SSL in the smtp client.
|
||||
|
||||
|
||||
myhostname = localhost
|
||||
alias_maps = hash:/etc/aliases
|
||||
alias_database = hash:/etc/aliases
|
||||
mydestination = /etc/mailname, localhost.localdomain, localhost
|
||||
relayhost =
|
||||
relayhost =
|
||||
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
|
||||
mailbox_size_limit = 0
|
||||
recipient_delimiter = +
|
||||
@ -76,4 +74,4 @@ smtpd_sasl_path = private/auth
|
||||
milter_default_action = accept
|
||||
milter_protocol = 2
|
||||
smtpd_milters = inet:localhost:8891
|
||||
non_smtpd_milters = inet:localhost:8891
|
||||
non_smtpd_milters = inet:localhost:8891
|
@ -12,4 +12,4 @@ submission inet n - n - - smtpd
|
||||
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
|
||||
-o smtpd_sender_restrictions=permit_sasl_authenticated,reject
|
||||
-o smtpd_relay_restrictions=permit_sasl_authenticated,reject
|
||||
-o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
|
||||
-o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
|
18
opendkim/Dockerfile
Normal file
18
opendkim/Dockerfile
Normal file
@ -0,0 +1,18 @@
|
||||
FROM ubuntu:14.10
|
||||
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
RUN locale-gen en_GB en_GB.UTF-8 && dpkg-reconfigure locales
|
||||
|
||||
# Prerequisites
|
||||
RUN apt-get update && apt-get install -y \
|
||||
opendkim && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
# configure settings script
|
||||
VOLUME ["/mail_settings"]
|
||||
COPY boot /boot
|
||||
RUN chmod 755 /boot
|
||||
|
||||
# start necessary services for operation (dovecot -F starts dovecot in the foreground to prevent container exit)
|
||||
ENTRYPOINT /boot; service rsyslog start; opendkim -f
|
5
opendkim/boot
Normal file
5
opendkim/boot
Normal file
@ -0,0 +1,5 @@
|
||||
# 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
|
Loading…
Reference in New Issue
Block a user