From b8726b80a41cb1669c96bdef03b02840418eeee2 Mon Sep 17 00:00:00 2001 From: Christian Glahn Date: Tue, 29 Jan 2019 15:48:42 +0100 Subject: [PATCH 1/2] activate SA shortcircuit features via env, fixes #1118 --- README.md | 16 ++++++++++++++++ target/start-mailserver.sh | 14 ++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a3b62795..1eff9d23 100644 --- a/README.md +++ b/README.md @@ -474,6 +474,22 @@ Note: this spamassassin setting needs `ENABLE_SPAMASSASSIN=1`. By default, the m Note: this spamassassin setting needs `ENABLE_SPAMASSASSIN=1` +##### SA_SHORTCIRCUIT_BAYES_SPAM + + - **1** => will activate spamassassin short circuiting for bayes spam detection. + +This will uncommend the respective line in ```/etc/spamassasin/local.cf``` + +Note: activate this only if you are confident in your bayes database for identifying spam. + +##### SA_SHORTCIRCUIT_BAYES_HAM + + - **1** => will activate spamassassin short circuiting for bayes ham detection + +This will uncommend the respective line in ```/etc/spamassasin/local.cf``` + +Note: activate this only if you are confident in your bayes database for identifying ham. + ## Fetchmail ##### ENABLE_FETCHMAIL diff --git a/target/start-mailserver.sh b/target/start-mailserver.sh index 810ca7c4..ddca360d 100644 --- a/target/start-mailserver.sh +++ b/target/start-mailserver.sh @@ -625,8 +625,8 @@ function _setup_dovecot() { sed -i "s/#sieve_after =/sieve_after =/" /etc/dovecot/conf.d/90-sieve.conf cp /tmp/docker-mailserver/after.dovecot.sieve /usr/lib/dovecot/sieve-global/ sievec /usr/lib/dovecot/sieve-global/after.dovecot.sieve - else - sed -i "s/ sieve_after =/ #sieve_after =/" /etc/dovecot/conf.d/90-sieve.conf + else + sed -i "s/ sieve_after =/ #sieve_after =/" /etc/dovecot/conf.d/90-sieve.conf fi chown docker:docker -R /usr/lib/dovecot/sieve* chmod 550 -R /usr/lib/dovecot/sieve* @@ -1390,6 +1390,16 @@ function _setup_security_stack() { else sed -i -r 's/^\$sa_spam_subject_tag (.*);/\$sa_spam_subject_tag = '"'$SA_SPAM_SUBJECT'"';/g' /etc/amavis/conf.d/20-debian_defaults fi + + # activate short circuits when SA BAYES is certain it has spam. + if [ "$SA_SHORTCIRCUIT_BAYES_SPAM" = 1 ]; then + sed -i -r 's/^# shortcircuit BAYES_99/shortcircuit BAYES_99/g' /etc/spamassassin/local.cf + fi + + if [ "$SA_SHORTCIRCUIT_BAYES_HAM" = 1 ]; then + sed -i -r 's/^# shortcircuit BAYES_00/shortcircuit BAYES_00/g' /etc/spamassassin/local.cf + fi + test -e /tmp/docker-mailserver/spamassassin-rules.cf && cp /tmp/docker-mailserver/spamassassin-rules.cf /etc/spamassassin/ fi From 739043d5018dd3072991a0cdb7a83a5f85cc2c5e Mon Sep 17 00:00:00 2001 From: "Christian P. Glahn" Date: Mon, 13 Jan 2020 14:36:58 +0100 Subject: [PATCH 2/2] fixed a typo in the bayes shortcircuit docu --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1eff9d23..c9fa6b2a 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ Download the docker-compose.yml, the .env and the setup.sh files: curl -o docker-compose.yml https://raw.githubusercontent.com/tomav/docker-mailserver/master/docker-compose.yml.dist curl -o .env https://raw.githubusercontent.com/tomav/docker-mailserver/master/.env.dist - + curl -o env-mailserver https://raw.githubusercontent.com/tomav/docker-mailserver/master/env-mailserver.dist #### Create a docker-compose environment @@ -426,9 +426,9 @@ If this is not set and reports are enabled with the old options, logrotate will Note: This variable used to control logrotate inside the container and sent the pflogsumm report when the logs were rotated. It is still supported for backwards compatibility, but the new option LOGROTATE_INTERVAL has been added that only rotates -the logs. +the logs. -##### LOGROTATE_INTERVAL +##### LOGROTATE_INTERVAL Defines the interval in which the mail log is being rotated. - **daily** => Rotate daily. @@ -478,7 +478,7 @@ Note: this spamassassin setting needs `ENABLE_SPAMASSASSIN=1` - **1** => will activate spamassassin short circuiting for bayes spam detection. -This will uncommend the respective line in ```/etc/spamassasin/local.cf``` +This will uncomment the respective line in ```/etc/spamassasin/local.cf``` Note: activate this only if you are confident in your bayes database for identifying spam. @@ -486,7 +486,7 @@ Note: activate this only if you are confident in your bayes database for identif - **1** => will activate spamassassin short circuiting for bayes ham detection -This will uncommend the respective line in ```/etc/spamassasin/local.cf``` +This will uncomment the respective line in ```/etc/spamassasin/local.cf``` Note: activate this only if you are confident in your bayes database for identifying ham.