2021-10-03 23:19:00 +00:00
|
|
|
ARG ALPINE_VERSION=3.13.6
|
|
|
|
ARG BASE_IMAGE=sutty/monit
|
|
|
|
FROM ${BASE_IMAGE}:${ALPINE_VERSION}
|
2019-09-10 23:10:18 +00:00
|
|
|
MAINTAINER "f <f@sutty.nl>"
|
2019-09-10 23:23:06 +00:00
|
|
|
|
|
|
|
# Install postfix and certificates
|
|
|
|
RUN apk add --no-cache postfix ca-certificates
|
|
|
|
# Generate params and remove packages
|
|
|
|
RUN install -dm 2750 -o root -g root /etc/ssl/private \
|
|
|
|
&& apk add --no-cache gnutls-utils \
|
|
|
|
&& certtool --generate-dh-params --outfile=/etc/ssl/private/2048.dh --bits=2048 \
|
|
|
|
&& certtool --generate-dh-params --outfile=/etc/ssl/private/512.dh --bits=512 \
|
|
|
|
&& apk del gnutls-utils
|
|
|
|
# Configure postfix
|
2021-04-01 20:51:39 +00:00
|
|
|
RUN postconf -e alias_maps='lmdb:/etc/postfix/aliases' \
|
|
|
|
&& postconf -e transport_maps='lmdb:/etc/postfix/transport' \
|
2019-09-10 23:23:06 +00:00
|
|
|
&& postconf -e recipient_delimiter='+' \
|
|
|
|
&& postconf -e sendmail_path='/usr/sbin/sendmail' \
|
|
|
|
&& postconf -e newaliases_path='/usr/bin/newaliases' \
|
|
|
|
&& postconf -e mailq_path='/usr/bin/mailq' \
|
|
|
|
&& postconf -e setgid_group='postdrop' \
|
|
|
|
&& postconf -e manpage_directory='/usr/share/man' \
|
|
|
|
&& postconf -e sample_directory='/etc/postfix/sample' \
|
|
|
|
&& postconf -e readme_directory='/usr/share/doc/postfix' \
|
|
|
|
&& postconf -e html_directory='no' \
|
|
|
|
&& postconf -e soft_bounce='no' \
|
2020-09-03 15:47:39 +00:00
|
|
|
&& postconf -e mydestination='/etc/postfix/maps/domains.cf' \
|
2019-09-10 23:23:06 +00:00
|
|
|
&& postconf -e inet_interfaces='all' \
|
|
|
|
&& postconf -e local_recipient_maps='unix:passwd.byname $alias_maps' \
|
2020-11-17 17:59:48 +00:00
|
|
|
&& postconf -e mynetworks_style='subnet' \
|
2019-09-10 23:23:06 +00:00
|
|
|
&& postconf -e home_mailbox='Maildir/' \
|
|
|
|
&& postconf -e message_size_limit=20480000 \
|
|
|
|
&& postconf -e inet_protocols='all' \
|
|
|
|
&& postconf -e disable_vrfy_command=yes \
|
|
|
|
&& postconf -e smtpd_helo_required=yes \
|
|
|
|
&& postconf -e smtpd_helo_restrictions='permit_mynetworks,permit_sasl_authenticated,reject_non_fqdn_helo_hostname,reject_invalid_helo_hostname,reject_unknown_helo_hostname,permit' \
|
|
|
|
&& postconf -e smtpd_recipient_restrictions='reject_non_fqdn_recipient,reject_unknown_recipient_domain,permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination,reject_non_fqdn_sender,reject_unlisted_recipient' \
|
|
|
|
&& postconf -e smtpd_sender_restrictions='permit_mynetworks,permit_sasl_authenticated,reject_non_fqdn_sender,reject_unknown_sender_domain,permit' \
|
|
|
|
&& postconf -e smtpd_data_restrictions='reject_unauth_pipelining' \
|
|
|
|
&& postconf -e smtpd_client_restrictions='permit_mynetworks,permit_sasl_authenticated' \
|
|
|
|
&& postconf -e smtpd_relay_restrictions='permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination' \
|
|
|
|
&& postconf -e smtpd_use_tls='yes' \
|
|
|
|
&& postconf -e smtpd_tls_auth_only='yes' \
|
|
|
|
&& postconf -e smtp_use_tls='yes' \
|
|
|
|
&& postconf -e smtp_tls_note_starttls_offer='yes' \
|
|
|
|
&& postconf -e smtpd_tls_CApath='/etc/ssl/certs' \
|
|
|
|
&& postconf -e tls_random_source='dev:/dev/urandom' \
|
|
|
|
&& postconf -e smtpd_tls_dh1024_param_file='/etc/ssl/private/2048.dh' \
|
|
|
|
&& postconf -e smtpd_tls_dh512_param_file='/etc/ssl/private/512.dh' \
|
|
|
|
&& postconf -e tls_preempt_cipherlist='yes' \
|
|
|
|
&& postconf -e smtpd_tls_security_level='may' \
|
|
|
|
&& postconf -e smtpd_tls_eecdh_grade='strong' \
|
|
|
|
&& postconf -e smtpd_tls_mandatory_ciphers='high' \
|
|
|
|
&& postconf -e smtpd_tls_ciphers='medium' \
|
|
|
|
&& postconf -e smtpd_tls_exclude_ciphers='aNULL,MD5,DES,3DES,DES-CBC3-SHA,RC4-SHA,AES256-SHA,AES128-SHA,eNULL,EXPORT,RC4,PSK,aECDH,EDH-DSS-DES-CBC3-SHA,EDH-RSA-DES-CDC3-SHA,KRB5-DE5,CBC3-SHA' \
|
|
|
|
&& postconf -e smtpd_tls_mandatory_protocols='TLSv1' \
|
|
|
|
&& postconf -e smtp_tls_ciphers='$smtpd_tls_ciphers' \
|
|
|
|
&& postconf -e smtp_tls_mandatory_ciphers='$smtpd_tls_mandatory_ciphers' \
|
|
|
|
&& postconf -e smtp_tls_protocols='!SSLv2,!SSLv3,TLSv1' \
|
|
|
|
&& postconf -e smtpd_tls_loglevel='0' \
|
|
|
|
&& postconf -e smtpd_tls_received_header='yes' \
|
|
|
|
&& postconf -e smtpd_tls_session_cache_timeout='3600s' \
|
|
|
|
&& postconf -e smtp_destination_concurrency_limit=2 \
|
|
|
|
&& postconf -e smtp_destination_rate_delay=1s \
|
|
|
|
&& postconf -e smtp_extra_recipient_limit=10 \
|
|
|
|
&& postconf -e append_dot_mydomain=yes \
|
2019-09-27 20:51:40 +00:00
|
|
|
&& postconf -e masquerade_domains='$mydomain' \
|
|
|
|
&& postconf -e non_smtpd_milters=inet:opendkim:8891 \
|
2020-11-17 17:59:48 +00:00
|
|
|
&& postconf -e milter_default_action=accept \
|
|
|
|
&& postconf -e milter_protocol=6 \
|
2021-04-01 20:51:39 +00:00
|
|
|
&& postconf -e virtual_alias_maps=lmdb:/etc/postfix/maps/virtual \
|
2020-09-08 23:41:08 +00:00
|
|
|
&& postconf -e sender_canonical_maps=tcp:postsrsd:10001 \
|
|
|
|
&& postconf -e sender_canonical_classes=envelope_sender \
|
|
|
|
&& postconf -e recipient_canonical_maps=tcp:postsrsd:10002 \
|
|
|
|
&& postconf -e recipient_canonical_classes=envelope_recipient,header_recipient
|
2019-09-27 20:51:40 +00:00
|
|
|
|
2019-09-10 23:23:06 +00:00
|
|
|
RUN newaliases
|
|
|
|
RUN postmap /etc/postfix/transport
|
|
|
|
|
|
|
|
# Enable service
|
|
|
|
COPY ./monit.conf /etc/monit.d/postfix.conf
|
|
|
|
COPY ./postfix.sh /usr/local/bin/postfix
|
|
|
|
RUN chmod 755 /usr/local/bin/postfix
|
|
|
|
|
2020-09-03 15:47:39 +00:00
|
|
|
VOLUME "/etc/postfix/maps"
|
2019-09-10 23:23:06 +00:00
|
|
|
|
|
|
|
# Port
|
|
|
|
EXPOSE 25
|