local sending and forwarding server
This commit is contained in:
parent
6278ed6f95
commit
882d89fb66
2 changed files with 5 additions and 23 deletions
15
Dockerfile
15
Dockerfile
|
@ -1,6 +1,3 @@
|
|||
# TODO: This configuration is only really useful for sending e-mail. It
|
||||
# receives and stores email for local users but we're not serving them
|
||||
# just yet.
|
||||
FROM sutty/monit:latest
|
||||
MAINTAINER "f <f@sutty.nl>"
|
||||
|
||||
|
@ -68,7 +65,11 @@ RUN postconf -e alias_maps='hash:/etc/postfix/aliases' \
|
|||
&& postconf -e masquerade_domains='$mydomain' \
|
||||
&& postconf -e non_smtpd_milters=inet:opendkim:8891 \
|
||||
&& postconf -e smtpd_milters=inet:opendkim:8891 \
|
||||
&& postconf -e virtual_alias_maps=hash:/etc/postfix/maps/virtual
|
||||
&& postconf -e virtual_alias_maps=hash:/etc/postfix/maps/virtual \
|
||||
&& 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
|
||||
|
||||
RUN newaliases
|
||||
RUN postmap /etc/postfix/transport
|
||||
|
@ -78,13 +79,7 @@ COPY ./monit.conf /etc/monit.d/postfix.conf
|
|||
COPY ./postfix.sh /usr/local/bin/postfix
|
||||
RUN chmod 755 /usr/local/bin/postfix
|
||||
|
||||
# Check config
|
||||
RUN monit -t
|
||||
|
||||
# Save email for later!
|
||||
VOLUME "/var/spool/postfix"
|
||||
VOLUME "/etc/postfix/maps"
|
||||
VOLUME "/home"
|
||||
|
||||
# Port
|
||||
EXPOSE 25
|
||||
|
|
13
postfix.sh
13
postfix.sh
|
@ -7,17 +7,4 @@ postconf -e smtpd_tls_key_file="/etc/letsencrypt/live/${SUTTY}/privkey.pem"
|
|||
postconf -e smtpd_tls_cert_file="/etc/letsencrypt/live/${SUTTY}/fullchain.pem"
|
||||
postconf -e mynetworks="127.0.0.0/8 [::1]/128 `ip route | grep -v default | cut -d " " -f 1`"
|
||||
|
||||
# Recreate users from ~
|
||||
for home in /home/*; do
|
||||
user="${home##*/}"
|
||||
test "${user}" = "*" && continue
|
||||
|
||||
uid="$(stat -c %u "${home}")"
|
||||
|
||||
# Skip if it already exists
|
||||
getent passwd ${user} >/dev/null && continue
|
||||
|
||||
adduser -h ${home} -s /bin/false -G users -D -H -u ${uid} ${user}
|
||||
done
|
||||
|
||||
exec /usr/sbin/postfix start
|
||||
|
|
Loading…
Reference in a new issue