From da17e8bf0bd68531f7b14602a7792e8477813f6f Mon Sep 17 00:00:00 2001 From: Christian Raue Date: Mon, 10 Jan 2022 12:29:11 +0100 Subject: [PATCH] add env var `LOGWATCH_SENDER` (#2362) Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com> --- docs/content/config/environment.md | 11 +++++++++-- mailserver.env | 10 ++++++++-- target/scripts/startup/setup-stack.sh | 4 ++++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/docs/content/config/environment.md b/docs/content/config/environment.md index 066cefa7..3696c977 100644 --- a/docs/content/config/environment.md +++ b/docs/content/config/environment.md @@ -266,9 +266,9 @@ Recipient address for pflogsumm reports. ##### PFLOGSUMM_SENDER -From address for pflogsumm reports. +Sender address (`FROM`) for pflogsumm reports if pflogsumm reports are enabled. -- **not set** => Use REPORT_SENDER or POSTMASTER_ADDRESS +- **not set** => Use REPORT_SENDER - => Specify the sender address ##### LOGWATCH_INTERVAL @@ -286,6 +286,13 @@ Recipient address for logwatch reports if they are enabled. - **not set** => Use REPORT_RECIPIENT or POSTMASTER_ADDRESS - => Specify the recipient address(es) +##### LOGWATCH_SENDER + +Sender address (`FROM`) for logwatch reports if logwatch reports are enabled. + +- **not set** => Use REPORT_SENDER +- => Specify the sender address + ##### REPORT_RECIPIENT (deprecated) Enables a report being sent (created by pflogsumm) on a regular basis. diff --git a/mailserver.env b/mailserver.env index 75521e1b..07f8e3e7 100644 --- a/mailserver.env +++ b/mailserver.env @@ -188,9 +188,9 @@ PFLOGSUMM_TRIGGER= # => Specify the recipient address(es) PFLOGSUMM_RECIPIENT= -# From address for pflogsumm reports. +# Sender address (`FROM`) for pflogsumm reports if pflogsumm reports are enabled. # -# not set => Use REPORT_SENDER or POSTMASTER_ADDRESS +# not set => Use REPORT_SENDER # => Specify the sender address PFLOGSUMM_SENDER= @@ -207,6 +207,12 @@ LOGWATCH_INTERVAL= # => Specify the recipient address(es) LOGWATCH_RECIPIENT= +# Sender address (`FROM`) for logwatch reports if logwatch reports are enabled. +# +# not set => Use REPORT_SENDER +# => Specify the sender address +LOGWATCH_SENDER= + # Enables a report being sent (created by pflogsumm) on a regular basis. (deprecated) # **0** => Report emails are disabled # 1 => Using POSTMASTER_ADDRESS as the recipient diff --git a/target/scripts/startup/setup-stack.sh b/target/scripts/startup/setup-stack.sh index 73d5e303..0c27df98 100644 --- a/target/scripts/startup/setup-stack.sh +++ b/target/scripts/startup/setup-stack.sh @@ -47,6 +47,7 @@ function _setup_default_vars # update REPORT_SENDER - must be done done after _check_hostname REPORT_SENDER="${REPORT_SENDER:=mailserver-report@${HOSTNAME}}" + LOGWATCH_SENDER="${LOGWATCH_SENDER:=${REPORT_SENDER}}" PFLOGSUMM_SENDER="${PFLOGSUMM_SENDER:=${REPORT_SENDER}}" # set PFLOGSUMM_TRIGGER here for backwards compatibility @@ -69,6 +70,7 @@ function _setup_default_vars LOGWATCH_RECIPIENT="${LOGWATCH_RECIPIENT:=${REPORT_RECIPIENT}}" VARS[LOGWATCH_RECIPIENT]="${LOGWATCH_RECIPIENT}" + VARS[LOGWATCH_SENDER]="${LOGWATCH_SENDER}" VARS[PFLOGSUMM_RECIPIENT]="${PFLOGSUMM_RECIPIENT}" VARS[PFLOGSUMM_SENDER]="${PFLOGSUMM_SENDER}" VARS[PFLOGSUMM_TRIGGER]="${PFLOGSUMM_TRIGGER}" @@ -1484,6 +1486,8 @@ function _setup_logwatch echo 'LogFile = /var/log/mail/freshclam.log' >>/etc/logwatch/conf/logfiles/clam-update.conf + echo "MailFrom = ${LOGWATCH_SENDER}" >> /etc/logwatch/conf/logwatch.conf + case "${LOGWATCH_INTERVAL}" in 'daily' ) _notify 'inf' "Creating daily cron job for logwatch reports"