[info=bd3c05edf72ae548625da79cc726bacb]

OBS-URL: https://build.opensuse.org/package/show/devel:BCI:Tumbleweed/postfix-image?expand=0&rev=16
This commit is contained in:
Dan Čermák 2024-08-15 14:50:52 +00:00 committed by Git OBS Bridge
parent 29b5714e19
commit 89a3ba93f1
4 changed files with 32 additions and 50 deletions

View File

@ -40,7 +40,7 @@ LABEL org.opensuse.release-stage="released"
# endlabelprefix # endlabelprefix
LABEL io.artifacthub.package.readme-url="https://raw.githubusercontent.com/SUSE/BCI-dockerfile-generator/Tumbleweed/postfix-image/README.md" LABEL io.artifacthub.package.readme-url="https://raw.githubusercontent.com/SUSE/BCI-dockerfile-generator/Tumbleweed/postfix-image/README.md"
ENTRYPOINT ["/entrypoint/entrypoint.sh"] ENTRYPOINT ["/entrypoint/entrypoint.sh"]
CMD ["postfix", "start"] CMD ["postfix", "start-fg"]
EXPOSE 25 465 587 EXPOSE 25 465 587
RUN set -euo pipefail; mkdir -p /entrypoint/ldap RUN set -euo pipefail; mkdir -p /entrypoint/ldap
COPY entrypoint.sh /entrypoint/entrypoint.sh COPY entrypoint.sh /entrypoint/entrypoint.sh

View File

@ -166,7 +166,6 @@ setup_submission() {
echo "Enable submission port" echo "Enable submission port"
echo "submission inet n - n - - smtpd" >> /etc/postfix/master.cf 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 if [ "${SMTPD_USE_TLS}" -eq "1" ]; then
echo " -o smtpd_tls_security_level=encrypt" >> /etc/postfix/master.cf echo " -o smtpd_tls_security_level=encrypt" >> /etc/postfix/master.cf
@ -180,7 +179,6 @@ setup_submission() {
echo "Enable submissions port" echo "Enable submissions port"
echo "smtps inet n - n - - smtpd" >> /etc/postfix/master.cf 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_tls_wrappermode=yes" >> /etc/postfix/master.cf
echo " -o smtpd_sasl_auth_enable=no" >> /etc/postfix/master.cf echo " -o smtpd_sasl_auth_enable=no" >> /etc/postfix/master.cf
else else
@ -194,7 +192,9 @@ setup_submission() {
SMTPD_TLS_CRT=${SMTPD_TLS_CRT:-"/etc/postfix/ssl/certs/tls.crt"} 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_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_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_CApath" "/etc/ssl/certs"
set_config_value "smtpd_tls_cert_file" "${SMTPD_TLS_CRT}" set_config_value "smtpd_tls_cert_file" "${SMTPD_TLS_CRT}"
set_config_value "smtpd_tls_key_file" "${SMTPD_TLS_KEY}" set_config_value "smtpd_tls_key_file" "${SMTPD_TLS_KEY}"
@ -350,6 +350,10 @@ configure_postfix() {
update_db "${i}" update_db "${i}"
done done
set_config_value "smtpd_sender_restrictions" "lmdb:/etc/postfix/access" set_config_value "smtpd_sender_restrictions" "lmdb:/etc/postfix/access"
# Log to stdout
set_config_value "maillog_file" "/dev/stdout"
# Generate and update maps # Generate and update maps
update_db access relay relay_recipients update_db access relay relay_recipients
@ -397,7 +401,6 @@ stop_postfix() {
) > /dev/null 2>&1 & ) > /dev/null 2>&1 &
postfix stop postfix stop
terminate /usr/sbin/syslogd
} }
stop_daemons() { stop_daemons() {
@ -405,26 +408,13 @@ stop_daemons() {
stop_spamassassin 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 # Main
# #
# if command starts with an option, prepend postfix # if command starts with an option, prepend postfix
if [ "${1:0:1}" = '-' ]; then if [ "${1:0:1}" = '-' ]; then
set -- postfix start "$@" set -- postfix start-fg "$@"
fi fi
init_trap init_trap
@ -441,9 +431,11 @@ setup_spamassassin
rm -f /var/spool/postfix/pid/master.pid rm -f /var/spool/postfix/pid/master.pid
if [ "$1" = 'postfix' ]; then if [ "$1" = 'postfix' ]; then
start_daemons "$@" if [ -n "${SPAMASSASSIN_HOST}" ]; then
echo "postfix running and ready" mkdir /run/spamass-milter
sleep infinity & wait $! chown sa-milter:postfix /run/spamass-milter
else chmod 751 /run/spamass-milter
exec "$@" su sa-milter -s /bin/sh -c "/usr/sbin/spamass-milter -p /run/spamass-milter/socket -g postfix -f -- -d ${SPAMASSASSIN_HOST}"
fi fi
fi
exec "$@"

View File

@ -166,7 +166,6 @@ setup_submission() {
echo "Enable submission port" echo "Enable submission port"
echo "submission inet n - n - - smtpd" >> /etc/postfix/master.cf 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 if [ "${SMTPD_USE_TLS}" -eq "1" ]; then
echo " -o smtpd_tls_security_level=encrypt" >> /etc/postfix/master.cf echo " -o smtpd_tls_security_level=encrypt" >> /etc/postfix/master.cf
@ -180,7 +179,6 @@ setup_submission() {
echo "Enable submissions port" echo "Enable submissions port"
echo "smtps inet n - n - - smtpd" >> /etc/postfix/master.cf 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_tls_wrappermode=yes" >> /etc/postfix/master.cf
echo " -o smtpd_sasl_auth_enable=no" >> /etc/postfix/master.cf echo " -o smtpd_sasl_auth_enable=no" >> /etc/postfix/master.cf
else else
@ -194,7 +192,9 @@ setup_submission() {
SMTPD_TLS_CRT=${SMTPD_TLS_CRT:-"/etc/postfix/ssl/certs/tls.crt"} 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_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_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_CApath" "/etc/ssl/certs"
set_config_value "smtpd_tls_cert_file" "${SMTPD_TLS_CRT}" set_config_value "smtpd_tls_cert_file" "${SMTPD_TLS_CRT}"
set_config_value "smtpd_tls_key_file" "${SMTPD_TLS_KEY}" set_config_value "smtpd_tls_key_file" "${SMTPD_TLS_KEY}"
@ -350,6 +350,10 @@ configure_postfix() {
update_db "${i}" update_db "${i}"
done done
set_config_value "smtpd_sender_restrictions" "lmdb:/etc/postfix/access" set_config_value "smtpd_sender_restrictions" "lmdb:/etc/postfix/access"
# Log to stdout
set_config_value "maillog_file" "/dev/stdout"
# Generate and update maps # Generate and update maps
update_db access relay relay_recipients update_db access relay relay_recipients
@ -387,32 +391,19 @@ stop_postfix() {
) > /dev/null 2>&1 & ) > /dev/null 2>&1 &
postfix stop postfix stop
terminate /usr/sbin/rsyslogd
} }
stop_daemons() { stop_daemons() {
stop_postfix "$@" 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 # Main
# #
# if command starts with an option, prepend postfix # if command starts with an option, prepend postfix
if [ "${1:0:1}" = '-' ]; then if [ "${1:0:1}" = '-' ]; then
set -- postfix start "$@" set -- postfix start-fg "$@"
fi fi
init_trap init_trap
@ -427,11 +418,5 @@ configure_postfix
# before starting services # before starting services
rm -f /var/spool/postfix/pid/master.pid 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" echo "[info] refer to postfix manual pages at https://www.postfix.org/postfix-manuals.html"
sleep infinity & wait $!
else
exec "$@" exec "$@"
fi

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Thu Aug 15 14:39:01 UTC 2024 - Priyanka Saggu <priyanka.saggu@suse.com>
- resync entrypoint scripts from upstream
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Aug 14 12:30:32 UTC 2024 - Dirk Mueller <dmueller@suse.com> Wed Aug 14 12:30:32 UTC 2024 - Dirk Mueller <dmueller@suse.com>