From d62052ad5c671fb509b7739b97dc0e076ead7485 Mon Sep 17 00:00:00 2001 From: Jonathan Gazeley Date: Fri, 23 Feb 2024 21:40:35 +0000 Subject: [PATCH 1/2] Postfix log to stdout and drop rsyslog --- Dockerfile | 2 +- etc/rsyslog.conf | 6 ------ etc/rsyslog.d/imux.conf | 3 --- etc/rsyslog.d/maillog.conf | 1 - etc/rsyslog.d/stdout.conf | 3 --- etc/supervisor.d/rsyslog.ini | 7 ------- smtp-relay.sh | 3 +++ 7 files changed, 4 insertions(+), 21 deletions(-) delete mode 100644 etc/rsyslog.conf delete mode 100644 etc/rsyslog.d/imux.conf delete mode 100644 etc/rsyslog.d/maillog.conf delete mode 100644 etc/rsyslog.d/stdout.conf delete mode 100644 etc/supervisor.d/rsyslog.ini diff --git a/Dockerfile b/Dockerfile index 0cb3296..1e8a2fd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM alpine:3.19 LABEL maintainer "Jonathan Gazeley" -RUN apk add --no-cache postfix rsyslog supervisor \ +RUN apk add --no-cache postfix supervisor \ && /usr/bin/newaliases COPY . / diff --git a/etc/rsyslog.conf b/etc/rsyslog.conf deleted file mode 100644 index fd1977e..0000000 --- a/etc/rsyslog.conf +++ /dev/null @@ -1,6 +0,0 @@ -# http://www.rsyslog.com/doc/ - -$ModLoad immark.so # provide --MARK-- message capability - -$IncludeConfig /etc/rsyslog.d/*.conf - diff --git a/etc/rsyslog.d/imux.conf b/etc/rsyslog.d/imux.conf deleted file mode 100644 index 41e3e2d..0000000 --- a/etc/rsyslog.d/imux.conf +++ /dev/null @@ -1,3 +0,0 @@ -# Input modules -module(load="imuxsock") -input(type="imuxsock" Socket="/var/run/rsyslog/dev/log" CreatePath="on") \ No newline at end of file diff --git a/etc/rsyslog.d/maillog.conf b/etc/rsyslog.d/maillog.conf deleted file mode 100644 index ee7da1e..0000000 --- a/etc/rsyslog.d/maillog.conf +++ /dev/null @@ -1 +0,0 @@ -mail.* -/var/log/maillog \ No newline at end of file diff --git a/etc/rsyslog.d/stdout.conf b/etc/rsyslog.d/stdout.conf deleted file mode 100644 index 84fb0ff..0000000 --- a/etc/rsyslog.d/stdout.conf +++ /dev/null @@ -1,3 +0,0 @@ -$ModLoad omstdout.so # provide messages to stdout - -*.* :omstdout: # send everything to stdout \ No newline at end of file diff --git a/etc/supervisor.d/rsyslog.ini b/etc/supervisor.d/rsyslog.ini deleted file mode 100644 index 15f59cb..0000000 --- a/etc/supervisor.d/rsyslog.ini +++ /dev/null @@ -1,7 +0,0 @@ -[program:rsyslog] -command=/usr/sbin/rsyslogd -n -numprocs=1 -autostart=true -autorestart=true -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 \ No newline at end of file diff --git a/smtp-relay.sh b/smtp-relay.sh index 5c47986..f20b146 100755 --- a/smtp-relay.sh +++ b/smtp-relay.sh @@ -31,4 +31,7 @@ postconf 'smtputf8_enable = no' || exit 1 # This makes sure the message id is set. If this is set to no dkim=fail will happen. postconf 'always_add_missing_headers = yes' || exit 1 +# Log to stdout +postconf 'maillog_file = /dev/stdout' || exit 1 + /usr/bin/supervisord -n From 12a4731f0ce07e0ed6f4c9aba30798f075463bc8 Mon Sep 17 00:00:00 2001 From: Jonathan Gazeley Date: Fri, 23 Feb 2024 22:02:33 +0000 Subject: [PATCH 2/2] Drop supervisor and run Postfix in the foreground --- Dockerfile | 2 +- etc/supervisor.d/postfix.ini | 6 ------ smtp-relay.sh | 3 ++- 3 files changed, 3 insertions(+), 8 deletions(-) delete mode 100644 etc/supervisor.d/postfix.ini diff --git a/Dockerfile b/Dockerfile index 1e8a2fd..33bfe11 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM alpine:3.19 LABEL maintainer "Jonathan Gazeley" -RUN apk add --no-cache postfix supervisor \ +RUN apk add --no-cache postfix \ && /usr/bin/newaliases COPY . / diff --git a/etc/supervisor.d/postfix.ini b/etc/supervisor.d/postfix.ini deleted file mode 100644 index 76fd367..0000000 --- a/etc/supervisor.d/postfix.ini +++ /dev/null @@ -1,6 +0,0 @@ -[program:postfix] -process_name = master -directory = /etc/postfix -command = /usr/sbin/postfix -c /etc/postfix start -startsecs = 0 -autorestart = false \ No newline at end of file diff --git a/smtp-relay.sh b/smtp-relay.sh index f20b146..e4d9bdb 100755 --- a/smtp-relay.sh +++ b/smtp-relay.sh @@ -34,4 +34,5 @@ postconf 'always_add_missing_headers = yes' || exit 1 # Log to stdout postconf 'maillog_file = /dev/stdout' || exit 1 -/usr/bin/supervisord -n +# Start postfix +postfix start-fg