Skip to content

Commit

Permalink
improve typo and config
Browse files Browse the repository at this point in the history
  • Loading branch information
Turgon37 committed Nov 3, 2018
1 parent 6330cd6 commit 2d4ab71
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 16 deletions.
35 changes: 27 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
FROM alpine:3.6
MAINTAINER Pierre GINDRAUD <pgindraud@gmail.com>
FROM alpine:3.7

ARG POSTFIX_VERSION
ARG RSYSLOG_VERSION
ARG IMAGE_VERSION
ARG BUILD_DATE
ARG VCS_REF

LABEL maintainer="Pierre GINDRAUD <pgindraud@gmail.com>" \
org.label-schema.build-date="${BUILD_DATE}" \
org.label-schema.name="SMTP server configured as a email relay" \
org.label-schema.description="This image contains the reliable postfix smtp server configured to be " \
org.label-schema.url="https://github.com/Turgon37/docker-smtp-relay" \
org.label-schema.vcs-ref="${VCS_REF}" \
org.label-schema.vcs-url="https://github.com/Turgon37/docker-smtp-relay" \
org.label-schema.vendor="Pierre GINDRAUD" \
org.label-schema.version="${IMAGE_VERSION}" \
org.label-schema.schema-version="1.0" \
application.postfix.version="${POSTFIX_VERSION}" \
application.rsyslog.version="${RSYSLOG_VERSION}" \
image.version="${IMAGE_VERSION}"

ENV RELAY_MYDOMAIN=domain.com \
RELAY_MYNETWORKS=127.0.0.0/8 \
Expand All @@ -21,8 +40,8 @@ RUN apk --no-cache add \
cyrus-sasl \
cyrus-sasl-digestmd5 \
cyrus-sasl-crammd5 \
postfix \
rsyslog \
postfix=$POSTFIX_VERSION \
rsyslog=$RSYSLOG_VERSION \
supervisor \

# Configuration of main.cf
Expand All @@ -43,21 +62,21 @@ RUN apk --no-cache add \
&& postconf -e 'smtputf8_enable = no' \

# Configuration of sasl2
&& mkdir -p /etc/sasl2/ \
&& mkdir -p /etc/sasl2 \
&& echo 'pwcheck_method: auxprop' > /etc/sasl2/smtpd.conf \
&& echo 'auxprop_plugin: sasldb' >> /etc/sasl2/smtpd.conf \
&& echo 'mech_list: PLAIN LOGIN CRAM-MD5 DIGEST-MD5' >> /etc/sasl2/smtpd.conf

# copy local files
COPY root/ /

RUN echo '' > /etc/postfix/aliases \
&& echo '' > /etc/postfix/sender_canonical \
RUN touch /etc/postfix/aliases \
&& touch /etc/postfix/sender_canonical \
&& mkdir -p /data \
&& ln -s /data/sasldb2 /etc/sasldb2 \
&& chmod +x /start.sh /saslpasswd.sh /listpasswd.sh

EXPOSE 25
EXPOSE 25/tcp
VOLUME ["/data"]
WORKDIR /data

Expand Down
9 changes: 1 addition & 8 deletions root/etc/rsyslog.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,12 @@ $FileCreateMode 0640
$DirCreateMode 0755
$Umask 0022

# Include configuration files from directory
$IncludeConfig /etc/rsyslog.d/*

# Check config syntax on startup and abort if unclean (default off)
#$AbortOnUncleanConfig on
$AbortOnUncleanConfig on

# Reduce repeating messages (default off)
#$RepeatedMsgReduction on

# Log all kernel messages to the console.
# Logging much else clutters up the screen.
#kern.* /dev/console

# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.*;authpriv.none;cron.none /proc/self/fd/2
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions root/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
set -e

# Set configuration according to ENV
echo "Settings postfix..."
postconf -e "mydomain = $RELAY_MYDOMAIN"
postconf -e "mynetworks = $RELAY_MYNETWORKS"
postconf -e "relayhost = $RELAY_HOST"
Expand Down Expand Up @@ -84,6 +85,7 @@ if [ "$RELAY_STRICT_SENDER_MYDOMAIN" = 'true' ]; then
postconf -e "smtpd_sender_restrictions = check_sender_access inline:{$RELAY_MYDOMAIN=OK}, reject"
fi

echo "Bulk registering sasl users..."
# Fill the sasl user database with seed
if [ -f /etc/postfix/client_sasl_passwd ]; then
[ ! -r /etc/postfix/client_sasl_passwd ] && {
Expand All @@ -98,4 +100,5 @@ if [ -f /etc/postfix/client_sasl_passwd ]; then
done
fi

echo "Starting up..."
exec /usr/bin/supervisord -c /etc/supervisord.conf

0 comments on commit 2d4ab71

Please sign in to comment.