Signed-off-by: Jess Frazelle <acidburn@google.com>
This commit is contained in:
Jess Frazelle 2017-01-14 16:16:44 -08:00
parent 147fea10ab
commit 3fef00b940
No known key found for this signature in database
GPG Key ID: 18F3685C0022BFF3
2 changed files with 15 additions and 14 deletions

View File

@ -2,6 +2,7 @@ FROM alpine:edge
RUN apk add --no-cache \ RUN apk add --no-cache \
bash \ bash \
ca-certificates \
libsasl \ libsasl \
postfix \ postfix \
rsyslog \ rsyslog \

View File

@ -1,44 +1,44 @@
#!/bin/bash #!/bin/bash
set -e set -e
# Avoid warning: smtputf8_enable is true, but EAI support is not compiled in
echo "smtputf8_enable = no" >> /etc/postfix/main.cf
# Do we want to modify the config first with the script? # Do we want to modify the config first with the script?
[ -f /etc/service/postfix/run.config ] && source /etc/service/postfix/run.config [ -f /etc/service/postfix/run.config ] && source /etc/service/postfix/run.config
if [ "$MAILNAME" ]; then if [[ ! -z "$MAILNAME" ]]; then
echo "$MAILNAME" > /etc/mailname echo "$MAILNAME" > /etc/mailname
postconf -e myhostname="$MAILNAME" postconf -e myhostname="$MAILNAME"
fi fi
if [ "$MY_NETWORKS" ]; then if [[ ! -z "$MY_NETWORKS" ]]; then
postconf -e mynetworks="$MY_NETWORKS" postconf -e mynetworks="$MY_NETWORKS"
fi fi
if [ "$MY_DESTINATION" ]; then if [[ ! -z "$MY_DESTINATION" ]]; then
postconf -e mydestination="$MY_DESTINATION" postconf -e mydestination="$MY_DESTINATION"
fi fi
if [ "$ROOT_ALIAS" ]; then if [[ ! -z "$ROOT_ALIAS" ]]; then
sed -i '/^root:/d' /etc/aliases if [[ -f /etc/aliases ]]; then
sed -i '/^root:/d' /etc/aliases
fi
echo "root: $ROOT_ALIAS" >> /etc/aliases echo "root: $ROOT_ALIAS" >> /etc/aliases
newaliases newaliases
fi fi
if [ "$RELAY" ]; then if [[ ! -z "$RELAY" ]]; then
# setup the relay # setup the relay
echo "relay_host = $RELAY" >> /etc/postfix/main.cf echo "relay_host = $RELAY" >> /etc/postfix/main.cf
fi fi
if [ "$SASL_AUTH" ]; then if [[ ! -z "$SASL_AUTH" ]]; then
# setup tls # setup tls
echo -e "smtp_sasl_auth_enable = yes\nsmtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd\nsmtp_sasl_security_options = noanonymous\nsmtp_use_tls = yes" >> /etc/postfix/main.cf echo -e "smtp_sasl_auth_enable = yes\nsmtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd\nsmtp_sasl_security_options = noanonymous\nsmtp_use_tls = yes\ninet_interfaces = 127.0.0.1" >> /etc/postfix/main.cf
# Avoid warning: smtputf8_enable is true, but EAI support is not compiled in
echo "smtputf8_enable = no" >> /etc/postfix/main.cf
# generate the SASL password map # generate the SASL password map
cat > /etc/postfix/sasl_passwd <<- EOF echo "$RELAY $SASL_AUTH" > /etc/postfix/sasl_passwd
$RELAY $SASL_AUTH
EOF
# generate a .db file # generate a .db file
postmap /etc/postfix/sasl_passwd postmap /etc/postfix/sasl_passwd