mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
Implement undef option for SA_SPAM_SUBJECT (#767)
* Implement undef option for SA_SPAM_SUBJECT in amavis config * Add test for undef spam subject
This commit is contained in:
parent
c505177486
commit
d9502ab6e7
8
Makefile
8
Makefile
|
@ -187,6 +187,13 @@ run:
|
||||||
-e DMS_DEBUG=0 \
|
-e DMS_DEBUG=0 \
|
||||||
-h mail.my-domain.com -t $(NAME)
|
-h mail.my-domain.com -t $(NAME)
|
||||||
sleep 20
|
sleep 20
|
||||||
|
docker run -d --name mail_undef_spam_subject \
|
||||||
|
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
||||||
|
-v "`pwd`/test":/tmp/docker-mailserver-test \
|
||||||
|
-e ENABLE_SPAMASSASSIN=1 \
|
||||||
|
-e SA_SPAM_SUBJECT="undef" \
|
||||||
|
-h mail.my-domain.com -t $(NAME)
|
||||||
|
sleep 15
|
||||||
|
|
||||||
|
|
||||||
generate-accounts-after-run:
|
generate-accounts-after-run:
|
||||||
|
@ -246,6 +253,7 @@ clean:
|
||||||
mail_with_imap \
|
mail_with_imap \
|
||||||
mail_lmtp_ip \
|
mail_lmtp_ip \
|
||||||
mail_with_postgrey \
|
mail_with_postgrey \
|
||||||
|
mail_undef_spam_subject \
|
||||||
mail_postscreen \
|
mail_postscreen \
|
||||||
mail_override_hostname
|
mail_override_hostname
|
||||||
|
|
||||||
|
|
|
@ -1013,7 +1013,12 @@ function _setup_security_stack() {
|
||||||
SA_TAG=${SA_TAG:="2.0"} && sed -i -r 's/^\$sa_tag_level_deflt (.*);/\$sa_tag_level_deflt = '$SA_TAG';/g' /etc/amavis/conf.d/20-debian_defaults
|
SA_TAG=${SA_TAG:="2.0"} && sed -i -r 's/^\$sa_tag_level_deflt (.*);/\$sa_tag_level_deflt = '$SA_TAG';/g' /etc/amavis/conf.d/20-debian_defaults
|
||||||
SA_TAG2=${SA_TAG2:="6.31"} && sed -i -r 's/^\$sa_tag2_level_deflt (.*);/\$sa_tag2_level_deflt = '$SA_TAG2';/g' /etc/amavis/conf.d/20-debian_defaults
|
SA_TAG2=${SA_TAG2:="6.31"} && sed -i -r 's/^\$sa_tag2_level_deflt (.*);/\$sa_tag2_level_deflt = '$SA_TAG2';/g' /etc/amavis/conf.d/20-debian_defaults
|
||||||
SA_KILL=${SA_KILL:="6.31"} && sed -i -r 's/^\$sa_kill_level_deflt (.*);/\$sa_kill_level_deflt = '$SA_KILL';/g' /etc/amavis/conf.d/20-debian_defaults
|
SA_KILL=${SA_KILL:="6.31"} && sed -i -r 's/^\$sa_kill_level_deflt (.*);/\$sa_kill_level_deflt = '$SA_KILL';/g' /etc/amavis/conf.d/20-debian_defaults
|
||||||
SA_SPAM_SUBJECT=${SA_SPAM_SUBJECT:="***SPAM*** "} && sed -i -r 's/^\$sa_spam_subject_tag (.*);/\$sa_spam_subject_tag = '"'$SA_SPAM_SUBJECT'"';/g' /etc/amavis/conf.d/20-debian_defaults
|
SA_SPAM_SUBJECT=${SA_SPAM_SUBJECT:="***SPAM*** "}
|
||||||
|
if [ "$SA_SPAM_SUBJECT" == "undef" ]; then
|
||||||
|
sed -i -r 's/^\$sa_spam_subject_tag (.*);/\$sa_spam_subject_tag = undef;/g' /etc/amavis/conf.d/20-debian_defaults
|
||||||
|
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
|
||||||
test -e /tmp/docker-mailserver/spamassassin-rules.cf && cp /tmp/docker-mailserver/spamassassin-rules.cf /etc/spamassassin/
|
test -e /tmp/docker-mailserver/spamassassin-rules.cf && cp /tmp/docker-mailserver/spamassassin-rules.cf /etc/spamassassin/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -474,6 +474,8 @@ load 'test_helper/bats-assert/load'
|
||||||
assert_success
|
assert_success
|
||||||
run docker exec mail /bin/sh -c "grep '\$sa_spam_subject_tag' /etc/amavis/conf.d/20-debian_defaults | grep '= .SPAM: .'"
|
run docker exec mail /bin/sh -c "grep '\$sa_spam_subject_tag' /etc/amavis/conf.d/20-debian_defaults | grep '= .SPAM: .'"
|
||||||
assert_success
|
assert_success
|
||||||
|
run docker exec mail_undef_spam_subject /bin/sh -c "grep '\$sa_spam_subject_tag' /etc/amavis/conf.d/20-debian_defaults | grep '= undef'"
|
||||||
|
assert_success
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "checking spamassassin: all registered domains should see spam headers" {
|
@test "checking spamassassin: all registered domains should see spam headers" {
|
||||||
|
|
Loading…
Reference in a new issue