diff --git a/Dockerfile b/Dockerfile index ac7ebce..b7bc546 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,7 +40,7 @@ LABEL org.opensuse.release-stage="released" # endlabelprefix LABEL io.artifacthub.package.readme-url="https://raw.githubusercontent.com/SUSE/BCI-dockerfile-generator/Tumbleweed/postfix-image/README.md" ENTRYPOINT ["/entrypoint/entrypoint.sh"] -CMD ["postfix", "start"] +CMD ["postfix", "start-fg"] EXPOSE 25 465 587 RUN set -euo pipefail; mkdir -p /entrypoint/ldap COPY entrypoint.sh /entrypoint/entrypoint.sh diff --git a/entrypoint.sh b/entrypoint.sh index b30ffd7..24332d8 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -166,7 +166,6 @@ setup_submission() { echo "Enable submission port" echo "submission inet n - n - - smtpd" >> /etc/postfix/master.cf - echo " -o syslog_name=postfix/submission" >> /etc/postfix/master.cf if [ "${SMTPD_USE_TLS}" -eq "1" ]; then echo " -o smtpd_tls_security_level=encrypt" >> /etc/postfix/master.cf @@ -180,7 +179,6 @@ setup_submission() { echo "Enable submissions port" echo "smtps inet n - n - - smtpd" >> /etc/postfix/master.cf - echo " -o syslog_name=postfix/smtps" >> /etc/postfix/master.cf echo " -o smtpd_tls_wrappermode=yes" >> /etc/postfix/master.cf echo " -o smtpd_sasl_auth_enable=no" >> /etc/postfix/master.cf else @@ -194,7 +192,9 @@ setup_submission() { SMTPD_TLS_CRT=${SMTPD_TLS_CRT:-"/etc/postfix/ssl/certs/tls.crt"} SMTPD_TLS_KEY=${SMTPD_TLS_KEY:-"/etc/postfix/ssl/certs/tls.key"} + # smtpd_use_tls is deprecated and only for compatibility set_config_value "smtpd_use_tls" "yes" + set_config_value "smtpd_tls_security_level" "may" set_config_value "smtpd_tls_CApath" "/etc/ssl/certs" set_config_value "smtpd_tls_cert_file" "${SMTPD_TLS_CRT}" set_config_value "smtpd_tls_key_file" "${SMTPD_TLS_KEY}" @@ -350,6 +350,10 @@ configure_postfix() { update_db "${i}" done set_config_value "smtpd_sender_restrictions" "lmdb:/etc/postfix/access" + + # Log to stdout + set_config_value "maillog_file" "/dev/stdout" + # Generate and update maps update_db access relay relay_recipients @@ -397,7 +401,6 @@ stop_postfix() { ) > /dev/null 2>&1 & postfix stop - terminate /usr/sbin/syslogd } stop_daemons() { @@ -405,26 +408,13 @@ stop_daemons() { stop_spamassassin } -start_daemons() { - # Don't start syslogd in background while starting it in the background... - # Logging to stdout does not work else. - /usr/sbin/syslogd -n -S -O - & - if [ -n "${SPAMASSASSIN_HOST}" ]; then - mkdir /run/spamass-milter - chown sa-milter:postfix /run/spamass-milter - chmod 751 /run/spamass-milter - su sa-milter -s /bin/sh -c "/usr/sbin/spamass-milter -p /run/spamass-milter/socket -g postfix -f -- -d ${SPAMASSASSIN_HOST}" - fi - "$@" -} - # # Main # # if command starts with an option, prepend postfix if [ "${1:0:1}" = '-' ]; then - set -- postfix start "$@" + set -- postfix start-fg "$@" fi init_trap @@ -441,9 +431,11 @@ setup_spamassassin rm -f /var/spool/postfix/pid/master.pid if [ "$1" = 'postfix' ]; then - start_daemons "$@" - echo "postfix running and ready" - sleep infinity & wait $! -else - exec "$@" + if [ -n "${SPAMASSASSIN_HOST}" ]; then + mkdir /run/spamass-milter + chown sa-milter:postfix /run/spamass-milter + chmod 751 /run/spamass-milter + su sa-milter -s /bin/sh -c "/usr/sbin/spamass-milter -p /run/spamass-milter/socket -g postfix -f -- -d ${SPAMASSASSIN_HOST}" + fi fi +exec "$@" diff --git a/entrypoint.sles.sh b/entrypoint.sles.sh index 271204b..cf85a09 100644 --- a/entrypoint.sles.sh +++ b/entrypoint.sles.sh @@ -166,7 +166,6 @@ setup_submission() { echo "Enable submission port" echo "submission inet n - n - - smtpd" >> /etc/postfix/master.cf - echo " -o syslog_name=postfix/submission" >> /etc/postfix/master.cf if [ "${SMTPD_USE_TLS}" -eq "1" ]; then echo " -o smtpd_tls_security_level=encrypt" >> /etc/postfix/master.cf @@ -180,7 +179,6 @@ setup_submission() { echo "Enable submissions port" echo "smtps inet n - n - - smtpd" >> /etc/postfix/master.cf - echo " -o syslog_name=postfix/smtps" >> /etc/postfix/master.cf echo " -o smtpd_tls_wrappermode=yes" >> /etc/postfix/master.cf echo " -o smtpd_sasl_auth_enable=no" >> /etc/postfix/master.cf else @@ -194,7 +192,9 @@ setup_submission() { SMTPD_TLS_CRT=${SMTPD_TLS_CRT:-"/etc/postfix/ssl/certs/tls.crt"} SMTPD_TLS_KEY=${SMTPD_TLS_KEY:-"/etc/postfix/ssl/certs/tls.key"} + # smtpd_use_tls is deprecated and only for compatibility set_config_value "smtpd_use_tls" "yes" + set_config_value "smtpd_tls_security_level" "may" set_config_value "smtpd_tls_CApath" "/etc/ssl/certs" set_config_value "smtpd_tls_cert_file" "${SMTPD_TLS_CRT}" set_config_value "smtpd_tls_key_file" "${SMTPD_TLS_KEY}" @@ -350,6 +350,10 @@ configure_postfix() { update_db "${i}" done set_config_value "smtpd_sender_restrictions" "lmdb:/etc/postfix/access" + + # Log to stdout + set_config_value "maillog_file" "/dev/stdout" + # Generate and update maps update_db access relay relay_recipients @@ -382,37 +386,24 @@ stop_postfix() { ( while ! (ps -aux | grep qmgr | grep -v grep | awk '{print $2}' | tr '\n' ' ') > /dev/null 2>&1; do ((ms-- <= 0)) && break usleep 10000 - done - exec postfix flush - ) > /dev/null 2>&1 & + done + exec postfix flush + ) > /dev/null 2>&1 & postfix stop - terminate /usr/sbin/rsyslogd } stop_daemons() { stop_postfix "$@" } -start_daemons() { - # Don't start syslogd in background while starting it in the background... - # Logging to stdout does not work else. - echo '# rsyslog configuration file to log to stdout - module(load="imuxsock") # provides support for local system logging (e.g. via logger command) - - *.* action(type="omfile" file="/var/log/rsyslog.log")' > /entrypoint/rsyslog-stdout.conf - /usr/sbin/rsyslogd -f /entrypoint/rsyslog-stdout.conf -i /var/run/rsyslogd-stdout.pid - - "$@" -} - # # Main # # if command starts with an option, prepend postfix if [ "${1:0:1}" = '-' ]; then - set -- postfix start "$@" + set -- postfix start-fg "$@" fi init_trap @@ -427,11 +418,5 @@ configure_postfix # before starting services rm -f /var/spool/postfix/pid/master.pid -if [ "$1" = 'postfix' ]; then - start_daemons "$@" - echo "postfix running and ready" - echo "[info] refer to postfix manual pages at https://www.postfix.org/postfix-manuals.html" - sleep infinity & wait $! -else - exec "$@" -fi +echo "[info] refer to postfix manual pages at https://www.postfix.org/postfix-manuals.html" +exec "$@" diff --git a/postfix-image.changes b/postfix-image.changes index a74efa2..55a993f 100644 --- a/postfix-image.changes +++ b/postfix-image.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Aug 15 14:39:01 UTC 2024 - Priyanka Saggu + +- resync entrypoint scripts from upstream + ------------------------------------------------------------------- Wed Aug 14 12:30:32 UTC 2024 - Dirk Mueller