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 \
bash \
ca-certificates \
libsasl \
postfix \
rsyslog \

View File

@ -1,44 +1,44 @@
#!/bin/bash
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?
[ -f /etc/service/postfix/run.config ] && source /etc/service/postfix/run.config
if [ "$MAILNAME" ]; then
if [[ ! -z "$MAILNAME" ]]; then
echo "$MAILNAME" > /etc/mailname
postconf -e myhostname="$MAILNAME"
fi
if [ "$MY_NETWORKS" ]; then
if [[ ! -z "$MY_NETWORKS" ]]; then
postconf -e mynetworks="$MY_NETWORKS"
fi
if [ "$MY_DESTINATION" ]; then
if [[ ! -z "$MY_DESTINATION" ]]; then
postconf -e mydestination="$MY_DESTINATION"
fi
if [ "$ROOT_ALIAS" ]; then
if [[ ! -z "$ROOT_ALIAS" ]]; then
if [[ -f /etc/aliases ]]; then
sed -i '/^root:/d' /etc/aliases
fi
echo "root: $ROOT_ALIAS" >> /etc/aliases
newaliases
fi
if [ "$RELAY" ]; then
if [[ ! -z "$RELAY" ]]; then
# setup the relay
echo "relay_host = $RELAY" >> /etc/postfix/main.cf
fi
if [ "$SASL_AUTH" ]; then
if [[ ! -z "$SASL_AUTH" ]]; then
# 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
# Avoid warning: smtputf8_enable is true, but EAI support is not compiled in
echo "smtputf8_enable = no" >> /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
# generate the SASL password map
cat > /etc/postfix/sasl_passwd <<- EOF
$RELAY $SASL_AUTH
EOF
echo "$RELAY $SASL_AUTH" > /etc/postfix/sasl_passwd
# generate a .db file
postmap /etc/postfix/sasl_passwd