-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
73 lines (64 loc) · 3.37 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
FROM debian:bullseye-20221004-slim
ARG DOMAIN_NAME=example.com
RUN { \
echo postfix postfix/mailname string $DOMAIN_NAME; \
echo postfix postfix/main_mailer_type string 'Internet Site'; \
} | debconf-set-selections
RUN \
apt-get update && \
apt-get -y --no-install-recommends install \
procps \
postfix \
opendkim && \
apt-get -y install rsyslog && \
apt-get clean && \
rm -rf /var/lib/apt/lists
RUN echo "-----BEGIN PRIVATE KEY-----\n\
MIIEowIBAAKCAQEAyFSKkZovoW0J+YjC8jw8Dm6fdrH1SfVBBVF0gsflYM9n38pB\
DBCJdum9Rc7pEpxqYxtGUWhbmHln7ZAJJTsB5ARxckWSg82987jqKrUCAahkcT1k\
CtvwgnSZ2W1/JWRZHOLPv65ZATZk9jGa+F0q8LmqlTQ3wKj/OUSZc7LbBcWyymGD\
3Mkm7PkImk+6yuehMLfXzB4GTOud5FnSFX0kELApslpYa8rn2P3gb3RzSaXdRFfN\
LlMmgWfQrhRdXKPc9WhBvXFHhMdG6imTzhOoqzwOfaruOX2UXIczoogkkU+7Vhp/\
w8b1j45NPR863vCGIAxGnhQ9lIEhYQGsROappwIDAQABAoIBAHBNTFzxRZBF8xiK\
/VYUREqG4ygD/RDXxvp3PkxuSP0rZ/zBghOEVbturucqZehD/TPPv2y1htuD+6nm\
W+oeGSI9B2fa7paqyLiPSd5lGFnbj2sX0jRwNXS8bt6/jk5k4bvavkGjOEwAtTp6\
dniSqhbGzoTUAAkl8+Wjui5s7nFd8zpWp+Pc6fyng/rfRavrFj4EUqsiJ4EMG062\
hY+rRXxkAZlHiNnyZYaHrEI07Liwmi4w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-key.pem && \
chmod 0600 /etc/dkimkeys/dkim-key.pem
RUN \
echo "Domain $DOMAIN_NAME" >> /etc/opendkim.conf && \
echo 'Selector x' >> /etc/opendkim.conf && \
echo 'KeyFile /etc/dkimkeys/dkim-key.pem' >> /etc/opendkim.conf && \
echo 'Canonicalization relaxed' >> /etc/opendkim.conf && \
echo 'Mode sv' >> /etc/opendkim.conf
RUN \
echo 'smtpd_milters = inet:127.0.0.1:8891' >> /etc/postfix/main.cf && \
echo 'non_smtpd_milters = $smtpd_milters' >> /etc/postfix/main.cf && \
echo 'milter_default_action = accept' >> /etc/postfix/main.cf && \
echo 'milter_protocol = 6' >> /etc/postfix/main.cf
RUN \
sed -Ei "s/^#* *Socket\t(.*)$/#Socket\1/" /etc/opendkim.conf && \
sed -Ei "s/^#* *Socket\t(.*)(inet:8891@localhost)$/Socket\t\1\2/" /etc/opendkim.conf && \
if [ "$DOMAIN_NAME" != "localhost" ] && [ "$DOMAIN_NAME" != "example.com" ]; then \
postconf -e "smtpd_tls_cert_file = /etc/letsencrypt/live/$DOMAIN_NAME/fullchain.pem" && \
postconf -e "smtpd_tls_key_file = /etc/letsencrypt/live/$DOMAIN_NAME/privkey.pem"; \
fi
CMD service rsyslog start && service opendkim start && service postfix start && tail -F /var/log/mail.log