Move to Docker Compose and multiple containers

This commit is contained in:
Pierre Jaury
2016-02-24 07:44:49 +01:00
parent caab793716
commit d0006dc624
33 changed files with 260 additions and 175 deletions

10
postfix/Dockerfile Normal file
View File

@@ -0,0 +1,10 @@
FROM alpine
RUN apk add --update postfix postfix-sqlite rsyslog && rm -rf /var/cache/apk/*
COPY conf /etc/postfix
COPY rsyslog.conf /etc/rsyslog.conf
COPY start.sh /start.sh
CMD ["/start.sh"]

38
postfix/conf/main.cf Normal file
View File

@@ -0,0 +1,38 @@
###############
# General
###############
# The list of relayed networks is still loaded from a configuration file
mynetworks = 127.0.0.1/32 [::1]/128
# Empty alias list to override the configuration variable and disable NIS
alias_maps = hash:/etc/aliases
# SQLite configuration
sql = sqlite:${config_directory}/
# Only accept virtual emails
mydestination =
###############
# TLS
###############
smtpd_use_tls = yes
smtpd_tls_cert_file=/certs/cert.pem
smtpd_tls_key_file=/certs/key.pem
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
###############
# SASL
###############
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_type = dovecot
smtpd_sasl_path = inet:imap:2102
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
###############
# Virtual
###############
virtual_mailbox_domains = ${sql}sqlite-virtual_mailbox_domains.cf
virtual_alias_maps = ${sql}sqlite-virtual_alias_maps.cf
virtual_transport = lmtp:inet:imap:2525
lmtp_host_lookup = native

34
postfix/conf/master.cf Normal file
View File

@@ -0,0 +1,34 @@
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
# Exposed SMTP services
smtp inet n - n - - smtpd
submission inet n - n - - smtpd
-o smtpd_enforce_tls=yes
-o smtpd_sasl_auth_enable=yes
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
smtps inet n - n - - smtpd
-o smtpd_enforce_tls=yes
-o smtpd_sasl_auth_enable=yes
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
# Internal postfix services
pickup unix n - n 60 1 pickup
cleanup unix n - n - 0 cleanup
qmgr unix n - n 300 1 qmgr
tlsmgr unix - - n 1000? 1 tlsmgr
rewrite unix - - n - - trivial-rewrite
bounce unix - - n - 0 bounce
defer unix - - n - 0 bounce
trace unix - - n - 0 bounce
verify unix - - n - 1 verify
flush unix n - n 1000? 0 flush
proxymap unix - - n - - proxymap
smtp unix - - n - - smtp
relay unix - - n - - smtp
error unix - - n - - error
retry unix - - n - - error
discard unix - - n - - discard
lmtp unix - - n - - lmtp
anvil unix - - n - 1 anvil
scache unix - - n - 1 scache

View File

@@ -0,0 +1,6 @@
dbpath = /data/freeposte.db
query =
SELECT destination
FROM alias INNER JOIN domain ON alias.domain_id = domain.id
WHERE domain.name = '%d'
AND alias.localpart = '%u'

View File

@@ -0,0 +1,2 @@
dbpath = /data/freeposte.db
query = SELECT name FROM domain WHERE name='%s'

4
postfix/rsyslog.conf Normal file
View File

@@ -0,0 +1,4 @@
$ModLoad imuxsock
$template noTimestampFormat,"%syslogtag%%msg%\n"
$ActionFileDefaultTemplate noTimestampFormat
*.*;auth,authpriv.none /dev/stdout

4
postfix/start.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
/usr/lib/postfix/master &
rsyslogd -n