# NAME leenooks/smtp # VERSION latest FROM alpine # Change to http respositories, so they we can cache the install packages RUN if [ -n ${HTTP_PROXY} ] ; then sed -i -e s'/https/http/' /etc/apk/repositories; fi RUN apk add --no-cache postfix postfix-ldap cyrus-sasl cyrus-sasl-login opendkim opendkim-utils # SASL config COPY smtpd.conf /etc/sasl2/ RUN apk add shadow && useradd -rc "HUB Mail Relay" -M relay -NG mail -s /sbin/nologin && echo relay:SmTpR3l2Y | chpasswd \ && gpasswd -a postfix opendkim # 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 RUN chmod 644 /etc/postfix/ssl/ca.crts /etc/postfix/include/*cf # Enable DKIM RUN mkdir /run/opendkim COPY opendkim.conf /etc/opendkim/ COPY signing /etc/opendkim/signing/ COPY defaults /defaults/ COPY init /sbin/ VOLUME [ "/var/spool/postfix","/etc/postfix/custom","/var/mail/vhosts" ] EXPOSE 25 # Starting ENTRYPOINT [ "/sbin/init" ] # 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