Skip to content

Commit 582f537

Browse files
author
matfechner
committed
Add compliance-mailout container file
Signed-off-by: matfechner <mathias.fechner@gmx.net>
1 parent 27595fe commit 582f537

6 files changed

Lines changed: 70 additions & 0 deletions

File tree

compliance-mailout/Dockerfile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
FROM alpine:edge
2+
# install packages
3+
RUN apk update --no-cache \
4+
&& apk add --no-cache --update postfix bash openssl tini \
5+
&& apk add --no-cache --upgrade musl musl-utils \
6+
&& apk add dockerize --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/ \
7+
&& (rm "/tmp/"* 2>/dev/null || true) && (rm -rf /var/cache/apk/* 2>/dev/null || true)
8+
9+
RUN openssl genrsa -des3 -passout pass:x -out /etc/ssl/private/mailout.pass.key 4096 \
10+
&& openssl rsa -passin pass:x -in etc/ssl/private/mailout.pass.key \
11+
-out /etc/ssl/private/mailout.key \
12+
&& openssl req -new -key /etc/ssl/private/mailout.key -out /etc/ssl/private/mailout.csr \
13+
-subj "/C=DE/ST=Berlin/L=Berlin/O=OrgName/OU=Standards/CN=sovereigncloudstack.org" \
14+
&& openssl x509 -req -days 3650 -in /etc/ssl/private/mailout.csr -signkey /etc/ssl/private/mailout.key \
15+
-out /etc/ssl/certs/mailout.crt \
16+
&& rm /etc/ssl/private/mailout.pass.key
17+
18+
COPY main.cf /etc/postfix/main.cf.tmpl
19+
COPY relay_map /etc/postfix/relay_map
20+
COPY security /etc/postfix/security
21+
RUN postmap /etc/postfix/security
22+
RUN postmap /etc/postfix/relay_map
23+
COPY entrypoint.sh /
24+
RUN chmod +x /entrypoint.sh
25+
RUN rm /etc/postfix/security
26+
RUN rm /etc/postfix/relay_map
27+
28+
EXPOSE 25
29+
STOPSIGNAL SIGKILL
30+
31+
ENTRYPOINT ["/sbin/tini", "--"]
32+
CMD ["/entrypoint.sh"]

compliance-mailout/entrypoint.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env bash
2+
exec dockerize -template /etc/postfix/main.cf.tmpl:/etc/postfix/main.cf postfix start-fg

compliance-mailout/main.cf

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
alias_database = hash:/etc/aliases
2+
alias_maps = hash:/etc/aliases
3+
append_dot_mydomain = no
4+
biff = no
5+
compatibility_level = 2
6+
cyrus_sasl_config_path = /etc/postfix/sasl
7+
inet_interfaces = all
8+
inet_protocols = ipv4
9+
mailbox_size_limit = 0
10+
maillog_file = /dev/stdout
11+
mydestination = localhost.localdomain, localhost
12+
myhostname = {{ .Env.POSTFIX_MYHOSTNAME }}
13+
mynetworks = 127.0.0.0/8
14+
myorigin = {{ .Env.POSTFIX_MYORIGIN }}
15+
readme_directory = no
16+
recipient_delimiter = +
17+
relayhost =
18+
sender_dependent_relayhost_maps = hash:/etc/postfix/relayhost_map
19+
smtpd_banner = $myhostname ESMTP
20+
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
21+
smtpd_sasl_authenticated_header = yes
22+
smtpd_tls_cert_file=/etc/ssl/certs/mailout.crt
23+
smtpd_tls_key_file=/etc/ssl/private/mailoout.key
24+
smtpd_tls_security_level=encrypt
25+
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
26+
smtp_helo_name = {{ .Env.POSTFIX_SMTP_HELO_NAME }}
27+
smtp_sasl_password_maps=hash:/etc/postfix/security
28+
smtp_sasl_security_options = noanonymous
29+
smtp_tls_note_starttls_offer = yes
30+
smtp_tls_security_level = encrypt
31+
smtp_tls_security_level=encrypt
32+
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

compliance-mailout/postfix.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
POSTFIX_MYHOSTNAME=foo
2+
POSTFIX_MYORIGIN=foo.bar

compliance-mailout/relay_map

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@foo.bar [smtp.bar.foo]:587

compliance-mailout/security

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
foo@bar.foo foo@bar.foo:mytotalsecuresecret

0 commit comments

Comments
 (0)