introduce variable to control Amavis' loglevel (#1947)

This commit is contained in:
Georg Lauterbach 2021-05-06 23:51:45 +02:00 committed by GitHub
parent ba37ed115d
commit 04e98dc49f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 35 additions and 16 deletions

View file

@ -2,9 +2,8 @@
## Variables ## Variables
1. If an option doesn't work as documented here, check if you are running the latest image! 1. Values in **bold** are the default values.
2. Values in **bold** are the default values. 2. If an option doesn't work as documented here, check if you are running the latest image. The current `master` branch corresponds to the image `mailserver/docker-mailserver:edge`.
3. Since `docker-mailserver v7.1.0`, comparisons for environment variables are executed differently. If you previously used `VARIABLE=''` as the `empty` value, **update** to now use `VARIABLE=`.
### Assignments ### Assignments
@ -13,17 +12,17 @@
##### DMS_DEBUG ##### DMS_DEBUG
- **0** => Debug disabled - **0** => Debug disabled
- 1 => Enables debug on startup - 1 => Enables debug on startup
##### SUPERVISOR_LOGLEVEL ##### SUPERVISOR_LOGLEVEL
Here you can adjust the [log-level for Supervisor](http://supervisord.org/logging.html#activity-log-levels). Possible values are Here you can adjust the [log-level for Supervisor](http://supervisord.org/logging.html#activity-log-levels). Possible values are
- critical => Only show critical messages - critical => Only show critical messages
- error => Only show erroneous output - error => Only show erroneous output
- **warn** => Show warnings - **warn** => Show warnings
- info => Normal informational output - info => Normal informational output
- debug => Also show debug messages - debug => Also show debug messages
The log-level will show everything in its class and above. The log-level will show everything in its class and above.
@ -31,9 +30,18 @@ The log-level will show everything in its class and above.
Amavis content filter (used for ClamAV & SpamAssassin) Amavis content filter (used for ClamAV & SpamAssassin)
- 0 => Amavis is disabled - 0 => Amavis is disabled
- **1** => Amavis is enabled - **1** => Amavis is enabled
##### AMAVIS_LOGLEVEL
[This page](https://lists.amavis.org/pipermail/amavis-users/2011-March/000158.html) provides information on Amavis' logging statistics.
- -1/-2/-3 => Only show errors
- **0** => Show warnings
- 1/2 => Show default informational output
- 3/4/5 => log debug information (very verbose)
##### ENABLE_CLAMAV ##### ENABLE_CLAMAV
- **0** => Clamav is disabled - **0** => Clamav is disabled

View file

@ -22,8 +22,6 @@ The contents could look like this
``` sh ``` sh
#! /bin/bash #! /bin/bash
sed -i -E 's|(log_level).*|\1 = -1;|g' /etc/amavis/conf.d/49-docker-mailserver
cat >/etc/amavis/conf.d/50-user << "END" cat >/etc/amavis/conf.d/50-user << "END"
use strict; use strict;

View file

@ -69,6 +69,12 @@ ENABLE_CLAMAV=0
# 1 => Enabled # 1 => Enabled
ENABLE_AMAVIS=1 ENABLE_AMAVIS=1
# -1/-2/-3 => Only show errors
# **0** => Show warnings
# 1/2 => Show default informational output
# 3/4/5 => log debug information (very verbose)
AMAVIS_LOGLEVEL=0
# If you enable Fail2Ban, don't forget to add the following lines to your `docker-compose.yml`: # If you enable Fail2Ban, don't forget to add the following lines to your `docker-compose.yml`:
# cap_add: # cap_add:
# - NET_ADMIN # - NET_ADMIN

View file

@ -16,6 +16,7 @@ declare -a FUNCS_SETUP FUNCS_FIX FUNCS_CHECK FUNCS_MISC DAEMONS_START
# ? >> Setup of default and global values / variables # ? >> Setup of default and global values / variables
# #
VARS[AMAVIS_LOGLEVEL]="${AMAVIS_LOGLEVEL:=0}"
VARS[DEFAULT_RELAY_HOST]="${DEFAULT_RELAY_HOST:=}" VARS[DEFAULT_RELAY_HOST]="${DEFAULT_RELAY_HOST:=}"
VARS[DMS_DEBUG]="${DMS_DEBUG:=0}" VARS[DMS_DEBUG]="${DMS_DEBUG:=0}"
VARS[DOVECOT_MAILBOX_FORMAT]="${DOVECOT_MAILBOX_FORMAT:=maildir}" VARS[DOVECOT_MAILBOX_FORMAT]="${DOVECOT_MAILBOX_FORMAT:=maildir}"

View file

@ -1501,6 +1501,10 @@ function _setup_security_stack
then then
cp /tmp/docker-mailserver/amavis.cf /etc/amavis/conf.d/50-user cp /tmp/docker-mailserver/amavis.cf /etc/amavis/conf.d/50-user
fi fi
sed -i -E \
"s|(log_level).*|\1 = ${AMAVIS_LOGLEVEL};|g" \
/etc/amavis/conf.d/49-docker-mailserver
fi fi
} }

View file

@ -12,12 +12,13 @@ setup_file() {
local PRIVATE_CONFIG local PRIVATE_CONFIG
PRIVATE_CONFIG="$(duplicate_config_for_container .)" PRIVATE_CONFIG="$(duplicate_config_for_container .)"
docker run --rm -d --name mail_disabled_clamav_spamassassin \ docker run --rm -d --name mail_disabled_clamav_spamassassin \
-v "${PRIVATE_CONFIG}":/tmp/docker-mailserver \ -v "${PRIVATE_CONFIG}":/tmp/docker-mailserver \
-v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \ -v "$(pwd)/test/test-files":/tmp/docker-mailserver-test:ro \
-e ENABLE_CLAMAV=0 \ -e ENABLE_CLAMAV=0 \
-e ENABLE_SPAMASSASSIN=0 \ -e ENABLE_SPAMASSASSIN=0 \
-e DMS_DEBUG=0 \ -e DMS_DEBUG=0 \
-h mail.my-domain.com -t "${NAME}" -e AMAVIS_LOGLEVEL=2 \
-h mail.my-domain.com -t "${NAME}"
# TODO: find a better way to know when we have waited long enough # TODO: find a better way to know when we have waited long enough
# for clamav to should have come up, if it were enabled # for clamav to should have come up, if it were enabled
wait_for_smtp_port_in_container mail_disabled_clamav_spamassassin wait_for_smtp_port_in_container mail_disabled_clamav_spamassassin

View file

@ -25,6 +25,7 @@ setup_file() {
-e SA_TAG=-5.0 \ -e SA_TAG=-5.0 \
-e SA_TAG2=2.0 \ -e SA_TAG2=2.0 \
-e SA_KILL=3.0 \ -e SA_KILL=3.0 \
-e AMAVIS_LOGLEVEL=2 \
-e SA_SPAM_SUBJECT="SPAM: " \ -e SA_SPAM_SUBJECT="SPAM: " \
-e VIRUSMAILS_DELETE_DELAY=7 \ -e VIRUSMAILS_DELETE_DELAY=7 \
-e ENABLE_SRS=1 \ -e ENABLE_SRS=1 \