2017-07-23 07:56:38 +00:00
|
|
|
# NAME leenooks/smtp
|
|
|
|
# VERSION latest
|
|
|
|
|
2023-04-25 10:39:41 +00:00
|
|
|
FROM alpine
|
2017-07-23 07:56:38 +00:00
|
|
|
|
2023-04-25 10:39:41 +00:00
|
|
|
# Change to http respositories, so they we can cache the install packages
|
2023-05-02 07:16:10 +00:00
|
|
|
RUN if [ -n ${HTTP_PROXY} ] ; then sed -i -e s'/https/http/' /etc/apk/repositories; fi
|
2017-07-23 07:56:38 +00:00
|
|
|
|
2023-05-02 07:16:10 +00:00
|
|
|
RUN apk add --no-cache postfix postfix-ldap cyrus-sasl cyrus-sasl-login opendkim opendkim-utils
|
2023-04-28 05:16:31 +00:00
|
|
|
|
2023-05-02 07:16:10 +00:00
|
|
|
# SASL config
|
2023-04-28 05:16:31 +00:00
|
|
|
COPY smtpd.conf /etc/sasl2/
|
2023-05-02 07:16:10 +00:00
|
|
|
|
2023-04-28 05:16:31 +00:00
|
|
|
RUN apk add shadow && useradd -rc "HUB Mail Relay" -M relay -NG mail -s /sbin/nologin && echo relay:SmTpR3l2Y | chpasswd \
|
|
|
|
&& gpasswd -a postfix opendkim
|
2023-04-25 10:39:41 +00:00
|
|
|
|
2023-05-02 07:16:10 +00:00
|
|
|
# Config postfix
|
|
|
|
RUN sed -i -e 's%^#mynetworks = hash:/etc/postfix/network_table%mynetworks = /etc/opendkim/signing/TrustedHosts%' /etc/postfix/main.cf
|
|
|
|
COPY include /etc/postfix/include
|
|
|
|
COPY ssl /etc/postfix/ssl
|
2023-05-02 11:02:18 +00:00
|
|
|
RUN chmod 644 /etc/postfix/ssl/ca.crts /etc/postfix/include/*cf
|
2023-05-02 07:16:10 +00:00
|
|
|
|
2023-04-25 10:39:41 +00:00
|
|
|
# Enable DKIM
|
2023-05-02 07:16:10 +00:00
|
|
|
RUN mkdir /run/opendkim
|
2023-04-28 05:16:31 +00:00
|
|
|
COPY opendkim.conf /etc/opendkim/
|
|
|
|
COPY signing /etc/opendkim/signing/
|
2023-05-02 07:16:10 +00:00
|
|
|
COPY defaults /defaults/
|
2017-07-23 07:56:38 +00:00
|
|
|
|
|
|
|
COPY init /sbin/
|
|
|
|
|
2023-05-02 07:16:10 +00:00
|
|
|
VOLUME [ "/var/spool/postfix","/etc/postfix/custom","/var/mail/vhosts" ]
|
2023-04-28 05:16:31 +00:00
|
|
|
EXPOSE 25
|
|
|
|
|
2017-07-23 07:56:38 +00:00
|
|
|
# Starting
|
|
|
|
ENTRYPOINT [ "/sbin/init" ]
|
2023-05-02 07:16:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Control
|
|
|
|
#* add require EHLO - DONE
|
|
|
|
#* mydestination
|
|
|
|
#* ldap hostname via init in where clauses
|
|
|
|
#* virtual_alias_domain ? (Dont list in mydestination) OR (for unix accounts - DONT NEED?)
|
|
|
|
#* virtual_mailbox_domain (Dont list in mydestination)
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# 1 /etc/postfix/main.cf:
|
|
|
|
# 2 virtual_mailbox_domains = example.com ...more domains...
|
|
|
|
# 3 virtual_mailbox_base = /var/mail/vhosts
|
|
|
|
# 4 virtual_mailbox_maps = hash:/etc/postfix/vmailbox
|
|
|
|
# 5 virtual_minimum_uid = 100
|
|
|
|
# 6 virtual_uid_maps = static:5000
|
|
|
|
# 7 virtual_gid_maps = static:5000
|
|
|
|
# 8 virtual_alias_maps = hash:/etc/postfix/virtual
|
|
|
|
# 9
|
|
|
|
# 10 /etc/postfix/vmailbox:
|
|
|
|
# 11 info@example.com example.com/info
|
|
|
|
# 12 sales@example.com example.com/sales/
|
|
|
|
# 13 # Comment out the entry below to implement a catch-all.
|
|
|
|
# 14 # @example.com example.com/catchall
|
|
|
|
# 15 ...virtual mailboxes for more domains...
|
|
|
|
# 16
|
|
|
|
# 17 /etc/postfix/virtual:
|
|
|
|
# 18 postmaster@example.com postmaster
|
|
|
|
#
|
|
|
|
#TEST Environement:
|
|
|
|
#* dege.lan - virtual
|
|
|
|
#* dege.au - virtual
|
|
|
|
#* dlcm.co - virtual
|
|
|
|
#* bbs.dege.au - sync
|
|
|
|
#* dcml.au - axigen
|