Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consistently make 1 the default value for SPAMASSASSIN_SPAM_TO_INBOX #2361

Merged
merged 14 commits into from Feb 17, 2022

Conversation

craue
Copy link
Contributor

@craue craue commented Jan 6, 2022

According to

SPAMASSASSIN_SPAM_TO_INBOX=1
the default value is actually 1. I switched the order of both lines to have the default on top which seems to be the usual order. Let me know if further changes are needed.

@georglauterbach
Copy link
Member

Let me know if further changes are needed.

Yes - something you could not possibly know beforehand. Please also have a look at

VARS[SPAMASSASSIN_SPAM_TO_INBOX]="${SPAMASSASSIN_SPAM_TO_INBOX:=0}"

and change it

- VARS[SPAMASSASSIN_SPAM_TO_INBOX]="${SPAMASSASSIN_SPAM_TO_INBOX:=0}"
+ VARS[SPAMASSASSIN_SPAM_TO_INBOX]="${SPAMASSASSIN_SPAM_TO_INBOX:=1}"

cc @docker-mailserver/maintainers what do you all think about this? I'm fine with 1 being the (saner) default value (in my opinion).

@georglauterbach georglauterbach added area/configuration (file) area/scripts kind/improvement Improve an existing feature, configuration file or the documentation labels Jan 6, 2022
@georglauterbach georglauterbach added this to the v10.5.0 milestone Jan 6, 2022
@craue
Copy link
Contributor Author

craue commented Jan 6, 2022

VARS[SPAMASSASSIN_SPAM_TO_INBOX]="${SPAMASSASSIN_SPAM_TO_INBOX:=0}"

I see. So the real default value is 0? 😲 Wouldn't changing it in start-mailserver.sh be kind of a breaking change?

@georglauterbach
Copy link
Member

I see. So the real default value is 0?

Exactly 😆

Wouldn't changing it in start-mailserver.sh be kind of a breaking change?

Kind-of. That's why I cc'ed the maintainers :)

@casperklein
Copy link
Member

I am fine, with changing the default.

@craue craue changed the title docs: fix default value for SPAMASSASSIN_SPAM_TO_INBOX consistently make 1 the default value for SPAMASSASSIN_SPAM_TO_INBOX Jan 6, 2022
@craue
Copy link
Contributor Author

craue commented Jan 6, 2022

Done.

@casperklein
Copy link
Member

Some tests failed. They must be adjusted. I haven't look in detail. Setting explicitly SPAMASSASSIN_SPAM_TO_INBOX=0 should probably fix them.

@craue
Copy link
Contributor Author

craue commented Jan 7, 2022

Looks some more code needs to be changed. In case SPAMASSASSIN_SPAM_TO_INBOX was not set at all (and thus defaulted to 0), the warning Spam messages WILL NOT BE DELIVERED, you will NOT be notified of ANY message bounced. Please define SPAMASSASSIN_SPAM_TO_INBOX explicitly. was issued. How to handle this now?

@georglauterbach
Copy link
Member

georglauterbach commented Jan 7, 2022

The error message

not ok 112 checking amavis: spam message is bounced (rejected), undefined SPAMASSASSIN_SPAM_TO_INBOX should raise a warning in 8209ms

is there because a long time ago, it was (for whatever reason, it was before my time) decided that an undefined value should raise a warning. I'm not a fan of this behavior, as we should go for the safest method for the user. However, this would require you @craue to fiddle with the tests. Before we do, I'd like to hear @casperklein's ideas on that. I'd go for removing this test and properly set a default (1).

@polarathene
Copy link
Member

I refactored the warning test, so feel free to ask any questions.

If dropping the warning test case, it's just this portion, the other test case still seems relevant:

@test "checking amavis: spam message is bounced (rejected), undefined SPAMASSASSIN_SPAM_TO_INBOX should raise a warning" {
# SPAMASSASSIN_SPAM_TO_INBOX=0 is the default. If no explicit ENV value is set, it should log a warning at startup.
# shellcheck disable=SC2034
local TEST_DOCKER_ARGS=(
--env ENABLE_SPAMASSASSIN=1
)
common_container_setup 'TEST_DOCKER_ARGS'
run _should_emit_warning
assert_success
_should_bounce_spam
}

You'd also remove the function for testing the emitted warning, and it's two lines used in the other test case too:

# This warning should only be raised when the env SPAMASSASSIN_SPAM_TO_INBOX has no explicit value set
function _should_emit_warning() {
sh -c "docker logs ${TEST_NAME} | grep 'Spam messages WILL NOT BE DELIVERED'"
}

run _should_emit_warning
assert_failure

The tests for when the ENV is set to 1 is as mentioned at the top of that file, located here. That one uses the old test format, I have not refactored it yet.

I think prior to this PR, the warning was used to test the implicit/default value of the ENV to ensure that worked as expected too. Up to the other maintainers if it's still considered useful to test for a default expectation still, testing against the actual ENV value and expected is probably sufficient.

@georglauterbach
Copy link
Member

georglauterbach commented Jan 8, 2022

Ping @casperklein :)

(see my latest comment above)

@casperklein
Copy link
Member

Yes, removing the test makes sense 👍

@georglauterbach
Copy link
Member

Alright. @craus if you follow @polarathene's advice about how to remove the test(s) and also remove the following lines

VARS[SPAMASSASSIN_SPAM_TO_INBOX_SET]="${SPAMASSASSIN_SPAM_TO_INBOX:-not set}"

if [[ ${VARS[SPAMASSASSIN_SPAM_TO_INBOX_SET]} == 'not set' ]]
then
_notify 'warn' 'Spam messages WILL NOT BE DELIVERED, you will NOT be notified of ANY message bounced. Please define SPAMASSASSIN_SPAM_TO_INBOX explicitly.'
fi

we should be good to go. Sorry this got more engaged that anticipated, but this variable suffers from "legacy decisions" :) If you are ready, please ping me back to I can re-open the PR for review.

@casperklein
Copy link
Member

We should still warn the user, when mails can be rejected. So I would keep the warning, but with:

if [[ ${SPAMASSASSIN_SPAM_TO_INBOX} -ne 1 ]]

@georglauterbach
Copy link
Member

We should still warn the user, when mails can be rejected. So I would keep the warning, but with:

if [[ ${SPAMASSASSIN_SPAM_TO_INBOX} -ne 1 ]]

We could do that, but when explicitly setting the variable to 0 I would expect uses to know what they are doing based on the docs. Otherwise, we would need to emit warnings when using the ENABLE_DNSBL=0 variable as well. I think it is fine the way it is (I would not object to re-introducing it though). What do you think @craue?

@craue
Copy link
Contributor Author

craue commented Jan 9, 2022

That's not an easy decision. I also thought about suggesting to just keep this warning but I don't like the idea of flooding the logs with warnings one cannot get rid of (after having set 0 explicitly in this case).

@casperklein
Copy link
Member

ack

@georglauterbach
Copy link
Member

georglauterbach commented Jan 9, 2022

Alright. @craue I would, if you think this PR is ready, update the branch to be up-to-date with master. If tests pass, we can review and this PR is going to be merged.

@georglauterbach
Copy link
Member

georglauterbach commented Feb 13, 2022

@docker-mailserver/maintainers After a few more (unsuccessful) attempts, I re-enable the regular expression. I'd like to see this being merged because I have another PR "in the pipeline" I'd like to come up with. If there is nothing else you object to, please approve this. I have added a TODO statement for some future folks :D

@casperklein
Copy link
Member

@georglauterbach

Tried to replicate the behavior locally, but in all the runs I did I saw 14K

Interesting, I always get 13K.

Could you add this lines above the run statement in the test:

{
  echo -n "Debug: "
  docker exec mail /bin/sh -c "sed -i '/ENABLE_QUOTAS=0/d' /etc/dms-settings; listmailuser | grep user1@localhost\.localdomain"
  echo "Debug: E-Mail subjects -->"
  docker exec mail bash -c "find /var/mail/localhost.localdomain/user1/ -type f -exec grep -Hi subject {} \; | nl"
} >&3
This is the output from my "13K" test
 ✓ checking accounts: listmailuser (quotas enabled) [369]
Debug: * user1@localhost.localdomain ( 13K / ~ ) [0%]
Debug: E-Mail subjects -->
     1  /var/mail/localhost.localdomain/user1/.INBOX.spam/new/1644799219.M166410P4496.mail.my-domain.com,S=999,W=1024:Subject: Test Message sieve-spam-folder.txt
     2  /var/mail/localhost.localdomain/user1/.Junk/new/1644799216.M557078P4352.mail.my-domain.com,S=1259,W=1287:Subject: SPAM: Test Message amavis-spam.txt
     3  /var/mail/localhost.localdomain/user1/new/1644799219.M165198P4496.mail.my-domain.com,S=999,W=1024:Subject: Test Message sieve-spam-folder.txt
     4  /var/mail/localhost.localdomain/user1/new/1644799218.M958278P4496.mail.my-domain.com,S=1055,W=1080:Subject: Test Message existing-catchall-local.txt
     5  /var/mail/localhost.localdomain/user1/new/1644799218.M776793P4496.mail.my-domain.com,S=1063,W=1088:Subject: Test Message existing-regexp-alias-local.txt
     6  /var/mail/localhost.localdomain/user1/new/1644799218.M350329P4496.mail.my-domain.com,S=1122,W=1148:Subject: Test Message existing-user-and-cc-local-alias.txt
     7  /var/mail/localhost.localdomain/user1/new/1644799217.M594036P4480.mail.my-domain.com,S=1048,W=1073:Subject: Test Message existing-user1.txt
     8  /var/mail/localhost.localdomain/user1/new/1644799217.M425717P4393.mail.my-domain.com,S=801,W=819:Subject: Root Test Message
     9  /var/mail/localhost.localdomain/user1/new/1644799217.M59817P4352.mail.my-domain.com,S=1105,W=1130:Subject: Test Message existing-alias-recipient-delimiter.txt
    10  /var/mail/localhost.localdomain/user1/new/1644799216.M628601P4352.mail.my-domain.com,S=1058,W=1083:Subject: Test Message existing-alias-external.txt
    11  /var/mail/localhost.localdomain/user1/new/1644799216.M176294P4352.mail.my-domain.com,S=2485,W=2549:Subject: VIRUS (Win.Test.EICAR_HDB-1) in mail FROM [127.0.0.1]:47690
    12  /var/mail/localhost.localdomain/user1/new/1644799216.M176294P4352.mail.my-domain.com,S=2485,W=2549:Subject: Test Message amavis-virus.txt
    13  /var/mail/localhost.localdomain/user1/new/1644799216.M176294P4352.mail.my-domain.com,S=2485,W=2549:Subject: Test Message amavis-virus.txt

@georglauterbach
Copy link
Member

georglauterbach commented Feb 14, 2022

@casperklein Running on @craue's branch, I get this:

Successfully built 8076124f44bd
Successfully tagged mailserver-testing-craue:ci
 - first (skipped: This version natively supports setup/teardown_file)
 ✗ checking accounts: listmailuser (quotas enabled) [1173]
Debug: * user1@localhost.localdomain ( 14K / ~ ) [0%]
Debug: E-Mail subjects -->
     1  /var/mail/localhost.localdomain/user1/new/1644837995.M711585P4544.mail.my-domain.com,S=1001,W=1026:Subject: Test Message sieve-spam-folder.txt
     2  /var/mail/localhost.localdomain/user1/new/1644837985.M286051P4544.mail.my-domain.com,S=2492,W=2556:Subject: VIRUS (Win.Test.EICAR_HDB-1) in mail FROM [127.0.0.1]:51992
     3  /var/mail/localhost.localdomain/user1/new/1644837985.M286051P4544.mail.my-domain.com,S=2492,W=2556:Subject: Test Message amavis-virus.txt
     4  /var/mail/localhost.localdomain/user1/new/1644837985.M286051P4544.mail.my-domain.com,S=2492,W=2556:Subject: Test Message amavis-virus.txt
     5  /var/mail/localhost.localdomain/user1/new/1644837991.M104234P4544.mail.my-domain.com,S=1065,W=1090:Subject: Test Message existing-regexp-alias-local.txt
     6  /var/mail/localhost.localdomain/user1/new/1644837988.M327P4544.mail.my-domain.com,S=804,W=822:Subject: Root Test Message
     7  /var/mail/localhost.localdomain/user1/new/1644837991.M559723P4544.mail.my-domain.com,S=1057,W=1082:Subject: Test Message existing-catchall-local.txt
     8  /var/mail/localhost.localdomain/user1/new/1644837986.M159923P4544.mail.my-domain.com,S=1060,W=1085:Subject: Test Message existing-alias-external.txt
     9  /var/mail/localhost.localdomain/user1/new/1644837990.M353319P4544.mail.my-domain.com,S=1124,W=1150:Subject: Test Message existing-user-and-cc-local-alias.txt
    10  /var/mail/localhost.localdomain/user1/new/1644837988.M865065P4544.mail.my-domain.com,S=1050,W=1075:Subject: Test Message existing-user1.txt
    11  /var/mail/localhost.localdomain/user1/new/1644837988.M687708P4544.mail.my-domain.com,S=1107,W=1132:Subject: Test Message existing-alias-recipient-delimiter.txt
    12  /var/mail/localhost.localdomain/user1/.INBOX.spam/new/1644837995.M727062P4544.mail.my-domain.com,S=1001,W=1026:Subject: Test Message sieve-spam-folder.txt
    13  /var/mail/localhost.localdomain/user1/.Junk/new/1644837986.M941550P4544.mail.my-domain.com,S=1261,W=1289:Subject: SPAM: Test Message amavis-spam.txt
   (from function `assert_output' in file test/test_helper/bats-assert/src/assert.bash, line 239,
    in test file test/tests.bats, line 111)
     `assert_output '* user1@localhost.localdomain ( 13K / ~ ) [0%]'' failed
   doveadm(# this is a test comment, please don't delete me :'(): Error: User doesn't exist
   /usr/local/bin/listmailuser: line 15: 1024 *  : syntax error: operand expected (error token is "*  ")
   /usr/local/bin/listmailuser: line 15: 1024 *  : syntax error: operand expected (error token is "*  ")
   doveadm(# this is also a test comment, :O): Error: User doesn't exist
   /usr/local/bin/listmailuser: line 15: 1024 *  : syntax error: operand expected (error token is "*  ")
   /usr/local/bin/listmailuser: line 15: 1024 *  : syntax error: operand expected (error token is "*  ")
   grep: /var/mail/localhost.localdomain/user1/dovecot.index.cache: binary file matches
   grep: /var/mail/localhost.localdomain/user1/.INBOX.spam/dovecot.index.cache: binary file matches
   grep: /var/mail/localhost.localdomain/user1/.Junk/dovecot.index.cache: binary file matches
   
   -- output differs --
   expected : * user1@localhost.localdomain ( 13K / ~ ) [0%]
   actual   : * user1@localhost.localdomain ( 14K / ~ ) [0%]
   --
   

2 tests, 1 failure, 1 skipped in 72 seconds

make: *** [Makefile:41: tests] Error 1

Your debug statements are very good it seems. Maybe we can dig a little further here.

EDIT 1: It seems as if #2382 was reverted? But I don't see where... I will re-introduce it and see what happens.
EDIT 2: It seems as if the changes are just not on this branch? ...

@georglauterbach
Copy link
Member

georglauterbach commented Feb 14, 2022

This is the script I'm working with
#! /bin/bash

# shellcheck source=../scripts/helper-functions.sh
. /usr/local/bin/helper-functions.sh

# suppress error output, e.g. when listmailuser runs in a fresh container (DMS not running)
# shellcheck source=/dev/null
. /etc/dms-settings 2>/dev/null

function dovecot_quota_to_hr()
{
  if [[ ${1:-} == "-" ]]
  then
    echo "~"
  elif [[ ${1:-} =~ ^[0-9]+$ ]]
  then
    echo $(( 1024 * ${1} )) | numfmt --to=iec
  else
    _notify 'err' "Supplied non-number argument '${1:-}' to 'dovecot_quota_to_hr()' in script 'listmailuser'"
  fi
}

DATABASE="/tmp/docker-mailserver/postfix-accounts.cf"
ALIASES="/tmp/docker-mailserver/postfix-virtual.cf"

[[ -f ${DATABASE} ]] || errex "Error: No postfix-accounts.cf file"
[[ -s ${DATABASE} ]] || errex "Error: Empty postfix-accounts.cf - no accounts have been added"

while read -r LINE
do
  USER=$(echo "${LINE}" | cut -d'|' -f1)
  _is_comment "${USER}" && continue

  if [[ ${ENABLE_QUOTAS} -eq 1 ]]
  then
    # ${QUOTA[0]} => current size
    # ${QUOTA[1]} => configured size limit
    # ${QUOTA[2]} => usage in percent
    IFS=' ' read -r -a QUOTA <<< "$(doveadm quota get -u "${USER}" | tail +2 | awk '{ if ($3 == "STORAGE") { print $4" "$5" "$6 } }')"
    echo "* ${USER} ( $(dovecot_quota_to_hr "${QUOTA[0]}") / $(dovecot_quota_to_hr "${QUOTA[1]}") ) [${QUOTA[2]}%]"
  else
    echo "* ${USER}"
  fi

  if [[ -f ${ALIASES} ]] && grep -q "${USER}" "${ALIASES}"
  then
    echo -e "    [ aliases -> $(grep "${USER}" "${ALIASES}" | awk '{print $1;}' | sed ':a;N;$!ba;s/\n/, /g')]\n"
  else
    echo
  fi
done < "${DATABASE}"

exit 0
This is the corresponding test output (still failing)
Successfully built b26331da1717
Successfully tagged mailserver-testing-craue:ci
 - first (skipped: This version natively supports setup/teardown_file)
 ✗ checking accounts: listmailuser (quotas enabled) [1057]
Debug: * user1@localhost.localdomain ( 14K / ~ ) [0%]
Debug: E-Mail subjects -->
     1  /var/mail/localhost.localdomain/user1/new/1644840287.M489234P4492.mail.my-domain.com,S=1065,W=1090:Subject: Test Message existing-regexp-alias-local.txt
     2  /var/mail/localhost.localdomain/user1/new/1644840288.M360077P4492.mail.my-domain.com,S=1001,W=1026:Subject: Test Message sieve-spam-folder.txt
     3  /var/mail/localhost.localdomain/user1/new/1644840283.M41040P4452.mail.my-domain.com,S=2492,W=2556:Subject: VIRUS (Win.Test.EICAR_HDB-1) in mail FROM [127.0.0.1]:52332
     4  /var/mail/localhost.localdomain/user1/new/1644840283.M41040P4452.mail.my-domain.com,S=2492,W=2556:Subject: Test Message amavis-virus.txt
     5  /var/mail/localhost.localdomain/user1/new/1644840283.M41040P4452.mail.my-domain.com,S=2492,W=2556:Subject: Test Message amavis-virus.txt
     6  /var/mail/localhost.localdomain/user1/new/1644840283.M859517P4452.mail.my-domain.com,S=1060,W=1085:Subject: Test Message existing-alias-external.txt
     7  /var/mail/localhost.localdomain/user1/new/1644840286.M817893P4536.mail.my-domain.com,S=1124,W=1150:Subject: Test Message existing-user-and-cc-local-alias.txt
     8  /var/mail/localhost.localdomain/user1/new/1644840287.M764184P4492.mail.my-domain.com,S=1057,W=1082:Subject: Test Message existing-catchall-local.txt
     9  /var/mail/localhost.localdomain/user1/new/1644840285.M893991P4492.mail.my-domain.com,S=804,W=822:Subject: Root Test Message
    10  /var/mail/localhost.localdomain/user1/new/1644840285.M85293P4452.mail.my-domain.com,S=1050,W=1075:Subject: Test Message existing-user1.txt
    11  /var/mail/localhost.localdomain/user1/new/1644840284.M707084P4492.mail.my-domain.com,S=1107,W=1132:Subject: Test Message existing-alias-recipient-delimiter.txt
    12  /var/mail/localhost.localdomain/user1/.INBOX.spam/new/1644840288.M375997P4492.mail.my-domain.com,S=1001,W=1026:Subject: Test Message sieve-spam-folder.txt
    13  /var/mail/localhost.localdomain/user1/.Junk/new/1644840283.M641631P4452.mail.my-domain.com,S=1261,W=1289:Subject: SPAM: Test Message amavis-spam.txt
   (from function `assert_output' in file test/test_helper/bats-assert/src/assert.bash, line 239,
    in test file test/tests.bats, line 111)
     `assert_output '* user1@localhost.localdomain ( 13K / ~ ) [0%]'' failed
   grep: /var/mail/localhost.localdomain/user1/dovecot.index.cache: binary file matches
   grep: /var/mail/localhost.localdomain/user1/.INBOX.spam/dovecot.index.cache: binary file matches
   grep: /var/mail/localhost.localdomain/user1/.Junk/dovecot.index.cache: binary file matches
   
   -- output differs --
   expected : * user1@localhost.localdomain ( 13K / ~ ) [0%]
   actual   : * user1@localhost.localdomain ( 14K / ~ ) [0%]
   --
   

2 tests, 1 failure, 1 skipped in 58 seconds

make: *** [Makefile:41: tests] Error 1

The grep errors are expected of course.

@casperklein
Copy link
Member

EDIT 1: It seems as if #2382 was reverted? But I don't see where... I will re-introduce it and see what happens.

I cannot confirm this. Are you on the correct branch? --> patch-1

This is what I do: git clone --recurse-submodules https://github.com/craue/docker-mailserver && cd docker-mailserver && git checkout patch-1

@casperklein
Copy link
Member

casperklein commented Feb 14, 2022

So you also see 13 mails, but with a total size of 14K. Then there must be a difference in the mails content.

Next step could be, to debug output also the mails content, instead of just their subjects.

@georglauterbach
Copy link
Member

Yes, I checked out the branch but it was a later state. Pulling resolves this issue.

@casperklein
Copy link
Member

This will also print the mails content:

{
  echo -n "Debug: "
  docker exec mail /bin/sh -c "sed -i '/ENABLE_QUOTAS=0/d' /etc/dms-settings; listmailuser | grep user1@localhost\.localdomain"
  echo "Debug: E-Mail subjects -->"
  docker exec mail bash -c "find /var/mail/localhost.localdomain/user1/ -type f -exec grep -Hi subject: {} \; | nl"
  echo
  docker exec mail bash -c "find /var/mail/localhost.localdomain/user1/ -type f -not -name '*dovecot.index.cache*' -exec grep -li subject: {} \; | xargs -I'{}' bash -c 'echo Debug: E-Mail content: {}; echo; cat {}; echo -------------------------------------------------------------------------------------'"
} >&3

I recognized, that one mail is counted 3 times. So there are just 11 mails in total. See my comment in line 14.

Output
Debug: * user1@localhost.localdomain ( 13K / ~ ) [0%]
Debug: E-Mail subjects -->
     1	/var/mail/localhost.localdomain/user1/.INBOX.spam/new/1644868480.M194783P4527.mail.my-domain.com,S=999,W=1024:Subject: Test Message sieve-spam-folder.txt
     2	/var/mail/localhost.localdomain/user1/.Junk/new/1644868477.M691336P4368.mail.my-domain.com,S=1259,W=1287:Subject: SPAM: Test Message amavis-spam.txt
     3	/var/mail/localhost.localdomain/user1/new/1644868480.M193531P4527.mail.my-domain.com,S=999,W=1024:Subject: Test Message sieve-spam-folder.txt
     4	/var/mail/localhost.localdomain/user1/new/1644868480.M30544P4440.mail.my-domain.com,S=1055,W=1080:Subject: Test Message existing-catchall-local.txt
     5	/var/mail/localhost.localdomain/user1/new/1644868479.M832027P4440.mail.my-domain.com,S=1063,W=1088:Subject: Test Message existing-regexp-alias-local.txt
     6	/var/mail/localhost.localdomain/user1/new/1644868479.M311687P4368.mail.my-domain.com,S=1122,W=1148:Subject: Test Message existing-user-and-cc-local-alias.txt
     7	/var/mail/localhost.localdomain/user1/new/1644868478.M580923P4368.mail.my-domain.com,S=801,W=819:Subject: Root Test Message
     8	/var/mail/localhost.localdomain/user1/new/1644868478.M449170P4368.mail.my-domain.com,S=1048,W=1073:Subject: Test Message existing-user1.txt
     9	/var/mail/localhost.localdomain/user1/new/1644868478.M404592P4368.mail.my-domain.com,S=1105,W=1130:Subject: Test Message existing-alias-recipient-delimiter.txt
    10	/var/mail/localhost.localdomain/user1/new/1644868477.M928000P4368.mail.my-domain.com,S=1058,W=1083:Subject: Test Message existing-alias-external.txt

    # one mail, but 3 matches for 'subject:'
    11	/var/mail/localhost.localdomain/user1/new/1644868477.M435640P4368.mail.my-domain.com,S=2485,W=2549:Subject: VIRUS (Win.Test.EICAR_HDB-1) in mail FROM [127.0.0.1]:35742
    12	/var/mail/localhost.localdomain/user1/new/1644868477.M435640P4368.mail.my-domain.com,S=2485,W=2549:Subject: Test Message amavis-virus.txt
    13	/var/mail/localhost.localdomain/user1/new/1644868477.M435640P4368.mail.my-domain.com,S=2485,W=2549:Subject: Test Message amavis-virus.txt

Debug: E-Mail content: /var/mail/localhost.localdomain/user1/.INBOX.spam/new/1644868480.M194783P4527.mail.my-domain.com,S=999,W=1024

Return-Path: <SRS0=OLIA=S5=external.tld=user@my-domain.com>
Delivered-To: user1@localhost.localdomain
Received: from mail.my-domain.com
	by mail.my-domain.com with LMTP
	id mcWAC4CzCmKvEQAAUIhAew
	(envelope-from <SRS0=OLIA=S5=external.tld=user@my-domain.com>)
	for <user1@localhost.localdomain>; Mon, 14 Feb 2022 19:54:40 +0000
Received: from localhost (localhost [127.0.0.1])
	by mail.my-domain.com (Postfix) with ESMTP id 2E45B15D10
	for <user1@localhost.localdomain>; Mon, 14 Feb 2022 19:54:40 +0000 (UTC)
X-Virus-Scanned: Yes
X-Spam-Flag: NO
X-Spam-Score: 0.998
X-Spam-Level:
X-Spam-Status: No, score=0.998 tagged_above=-5 required=2
	tests=[HEADER_FROM_DIFFERENT_DOMAINS=1, NO_RECEIVED=-0.001,
	NO_RELAYS=-0.001] autolearn=no autolearn_force=no
From: Spambot <spam@spam.com>
To: Existing Local User <alias2@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message sieve-spam-folder.txt
Message-Id: <20220214195438.4F97815C88@mail.my-domain.com>

This is a test mail.

-------------------------------------------------------------------------------------
Debug: E-Mail content: /var/mail/localhost.localdomain/user1/.Junk/new/1644868477.M691336P4368.mail.my-domain.com,S=1259,W=1287

Return-Path: <SRS0=d2cG=S5=external.tld=spam@my-domain.com>
Delivered-To: user1@localhost.localdomain
Received: from mail.my-domain.com
	by mail.my-domain.com with LMTP
	id AHsuKX2zCmIQEQAAUIhAew
	(envelope-from <SRS0=d2cG=S5=external.tld=spam@my-domain.com>)
	for <user1@localhost.localdomain>; Mon, 14 Feb 2022 19:54:37 +0000
Received: from localhost (localhost [127.0.0.1])
	by mail.my-domain.com (Postfix) with ESMTP id A81E915C55
	for <user1@localhost.localdomain>; Mon, 14 Feb 2022 19:54:37 +0000 (UTC)
X-Quarantine-ID: <GjCJ4Up9nUpK>
X-Virus-Scanned: Yes
X-Spam-Flag: YES
X-Spam-Score: 1001.799
X-Spam-Level: ****************************************************************
X-Spam-Status: Yes, score=1001.799 tagged_above=-5 required=2
	tests=[DKIM_ADSP_NXDOMAIN=0.8, GTUBE=1000,
	HEADER_FROM_DIFFERENT_DOMAINS=1, NO_RECEIVED=-0.001, NO_RELAYS=-0.001,
	TVD_SPACE_RATIO=0.001] autolearn=no autolearn_force=no
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local User <user1@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: SPAM: Test Message amavis-spam.txt
Message-Id: <20220214195437.4180215C27@mail.my-domain.com>

This is a test mail.
XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X

-------------------------------------------------------------------------------------
Debug: E-Mail content: /var/mail/localhost.localdomain/user1/new/1644868480.M193531P4527.mail.my-domain.com,S=999,W=1024

Return-Path: <SRS0=OLIA=S5=external.tld=user@my-domain.com>
Delivered-To: user1@localhost.localdomain
Received: from mail.my-domain.com
	by mail.my-domain.com with LMTP
	id mcWAC4CzCmKvEQAAUIhAew
	(envelope-from <SRS0=OLIA=S5=external.tld=user@my-domain.com>)
	for <user1@localhost.localdomain>; Mon, 14 Feb 2022 19:54:40 +0000
Received: from localhost (localhost [127.0.0.1])
	by mail.my-domain.com (Postfix) with ESMTP id 2E45B15D10
	for <user1@localhost.localdomain>; Mon, 14 Feb 2022 19:54:40 +0000 (UTC)
X-Virus-Scanned: Yes
X-Spam-Flag: NO
X-Spam-Score: 0.998
X-Spam-Level:
X-Spam-Status: No, score=0.998 tagged_above=-5 required=2
	tests=[HEADER_FROM_DIFFERENT_DOMAINS=1, NO_RECEIVED=-0.001,
	NO_RELAYS=-0.001] autolearn=no autolearn_force=no
From: Spambot <spam@spam.com>
To: Existing Local User <alias2@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message sieve-spam-folder.txt
Message-Id: <20220214195438.4F97815C88@mail.my-domain.com>

This is a test mail.

-------------------------------------------------------------------------------------
Debug: E-Mail content: /var/mail/localhost.localdomain/user1/new/1644868480.M30544P4440.mail.my-domain.com,S=1055,W=1080

Return-Path: <SRS0=OLIA=S5=external.tld=user@my-domain.com>
Delivered-To: user1@localhost.localdomain
Received: from mail.my-domain.com
	by mail.my-domain.com with LMTP
	id oAXMAYCzCmJYEQAAUIhAew
	(envelope-from <SRS0=OLIA=S5=external.tld=user@my-domain.com>)
	for <user1@localhost.localdomain>; Mon, 14 Feb 2022 19:54:40 +0000
Received: from localhost (localhost [127.0.0.1])
	by mail.my-domain.com (Postfix) with ESMTP id 06B1615D04
	for <user1@localhost.localdomain>; Mon, 14 Feb 2022 19:54:40 +0000 (UTC)
X-Virus-Scanned: Yes
X-Spam-Flag: NO
X-Spam-Score: 1.798
X-Spam-Level: *
X-Spam-Status: No, score=1.798 tagged_above=-5 required=2
	tests=[DKIM_ADSP_NXDOMAIN=0.8, HEADER_FROM_DIFFERENT_DOMAINS=1,
	NO_RECEIVED=-0.001, NO_RELAYS=-0.001] autolearn=no autolearn_force=no
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local User <wildcard@localdomain2.com>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message existing-catchall-local.txt
Message-Id: <20220214195438.3C39E15C86@mail.my-domain.com>

This is a test mail.

-------------------------------------------------------------------------------------
Debug: E-Mail content: /var/mail/localhost.localdomain/user1/new/1644868479.M832027P4440.mail.my-domain.com,S=1063,W=1088

Return-Path: <SRS0=OLIA=S5=external.tld=user@my-domain.com>
Delivered-To: user1@localhost.localdomain
Received: from mail.my-domain.com
	by mail.my-domain.com with LMTP
	id +TuQMX+zCmJYEQAAUIhAew
	(envelope-from <SRS0=OLIA=S5=external.tld=user@my-domain.com>)
	for <user1@localhost.localdomain>; Mon, 14 Feb 2022 19:54:39 +0000
Received: from localhost (localhost [127.0.0.1])
	by mail.my-domain.com (Postfix) with ESMTP id C9FC715CF8
	for <user1@localhost.localdomain>; Mon, 14 Feb 2022 19:54:39 +0000 (UTC)
X-Virus-Scanned: Yes
X-Spam-Flag: NO
X-Spam-Score: 1.798
X-Spam-Level: *
X-Spam-Status: No, score=1.798 tagged_above=-5 required=2
	tests=[DKIM_ADSP_NXDOMAIN=0.8, HEADER_FROM_DIFFERENT_DOMAINS=1,
	NO_RECEIVED=-0.001, NO_RELAYS=-0.001] autolearn=no autolearn_force=no
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local User <test123@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message existing-regexp-alias-local.txt
Message-Id: <20220214195438.27A5715C85@mail.my-domain.com>

This is a test mail.

-------------------------------------------------------------------------------------
Debug: E-Mail content: /var/mail/localhost.localdomain/user1/new/1644868479.M311687P4368.mail.my-domain.com,S=1122,W=1148

Return-Path: <SRS0=OLIA=S5=external.tld=user@my-domain.com>
Delivered-To: user1@localhost.localdomain
Received: from mail.my-domain.com
	by mail.my-domain.com with LMTP
	id kGWOEn+zCmIQEQAAUIhAew
	(envelope-from <SRS0=OLIA=S5=external.tld=user@my-domain.com>)
	for <user1@localhost.localdomain>; Mon, 14 Feb 2022 19:54:39 +0000
Received: from localhost (localhost [127.0.0.1])
	by mail.my-domain.com (Postfix) with ESMTP id 4B81A15CE1
	for <user1@localhost.localdomain>; Mon, 14 Feb 2022 19:54:39 +0000 (UTC)
X-Virus-Scanned: Yes
X-Spam-Flag: NO
X-Spam-Score: 1.798
X-Spam-Level: *
X-Spam-Status: No, score=1.798 tagged_above=-5 required=2
	tests=[DKIM_ADSP_NXDOMAIN=0.8, HEADER_FROM_DIFFERENT_DOMAINS=1,
	NO_RECEIVED=-0.001, NO_RELAYS=-0.001] autolearn=no autolearn_force=no
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local User <user1@localhost.localdomain>
Cc: Existing Local Alias <alias2@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message existing-user-and-cc-local-alias.txt
Message-Id: <20220214195438.0150C15C7C@mail.my-domain.com>

This is a test mail.

-------------------------------------------------------------------------------------
Debug: E-Mail content: /var/mail/localhost.localdomain/user1/new/1644868478.M580923P4368.mail.my-domain.com,S=801,W=819

Return-Path: <SRS0=ns6K=S5=mail.my-domain.com=root@my-domain.com>
Delivered-To: user1@localhost.localdomain
Received: from mail.my-domain.com
	by mail.my-domain.com with LMTP
	id AO+YIn6zCmIQEQAAUIhAew
	(envelope-from <SRS0=ns6K=S5=mail.my-domain.com=root@my-domain.com>)
	for <user1@localhost.localdomain>; Mon, 14 Feb 2022 19:54:38 +0000
Received: by mail.my-domain.com (Postfix)
	id 8D4EC15CA3; Mon, 14 Feb 2022 19:54:38 +0000 (UTC)
Delivered-To: root@mail.my-domain.com
Received: by mail.my-domain.com (Postfix, from userid 0)
	id 8BC5E15CA2; Mon, 14 Feb 2022 19:54:38 +0000 (UTC)
Subject: Root Test Message
Message-Id: <20220214195438.8BC5E15CA2@mail.my-domain.com>
Date: Mon, 14 Feb 2022 19:54:38 +0000 (UTC)
From: root <SRS0=ns6K=S5=mail.my-domain.com=root@my-domain.com>

This is a test mail.
-------------------------------------------------------------------------------------
Debug: E-Mail content: /var/mail/localhost.localdomain/user1/new/1644868478.M449170P4368.mail.my-domain.com,S=1048,W=1073

Return-Path: <SRS0=OLIA=S5=external.tld=user@my-domain.com>
Delivered-To: user1@localhost.localdomain
Received: from mail.my-domain.com
	by mail.my-domain.com with LMTP
	id 6DS+Gn6zCmIQEQAAUIhAew
	(envelope-from <SRS0=OLIA=S5=external.tld=user@my-domain.com>)
	for <user1@localhost.localdomain>; Mon, 14 Feb 2022 19:54:38 +0000
Received: from localhost (localhost [127.0.0.1])
	by mail.my-domain.com (Postfix) with ESMTP id 6D15715C93
	for <user1@localhost.localdomain>; Mon, 14 Feb 2022 19:54:38 +0000 (UTC)
X-Virus-Scanned: Yes
X-Spam-Flag: NO
X-Spam-Score: 1.798
X-Spam-Level: *
X-Spam-Status: No, score=1.798 tagged_above=-5 required=2
	tests=[DKIM_ADSP_NXDOMAIN=0.8, HEADER_FROM_DIFFERENT_DOMAINS=1,
	NO_RECEIVED=-0.001, NO_RELAYS=-0.001] autolearn=no autolearn_force=no
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local User <user1@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message existing-user1.txt
Message-Id: <20220214195437.A781215C54@mail.my-domain.com>

This is a test mail.

-------------------------------------------------------------------------------------
Debug: E-Mail content: /var/mail/localhost.localdomain/user1/new/1644868478.M404592P4368.mail.my-domain.com,S=1105,W=1130

Return-Path: <SRS0=OLIA=S5=external.tld=user@my-domain.com>
Delivered-To: user1~test@localhost.localdomain
Received: from mail.my-domain.com
	by mail.my-domain.com with LMTP
	id +KUXGH6zCmIQEQAAUIhAew
	(envelope-from <SRS0=OLIA=S5=external.tld=user@my-domain.com>)
	for <user1~test@localhost.localdomain>; Mon, 14 Feb 2022 19:54:38 +0000
Received: from localhost (localhost [127.0.0.1])
	by mail.my-domain.com (Postfix) with ESMTP id 6239315C8A
	for <user1~test@localhost.localdomain>; Mon, 14 Feb 2022 19:54:38 +0000 (UTC)
X-Virus-Scanned: Yes
X-Spam-Flag: NO
X-Spam-Score: 1.798
X-Spam-Level: *
X-Spam-Status: No, score=1.798 tagged_above=-5 required=2
	tests=[DKIM_ADSP_NXDOMAIN=0.8, HEADER_FROM_DIFFERENT_DOMAINS=1,
	NO_RECEIVED=-0.001, NO_RELAYS=-0.001] autolearn=no autolearn_force=no
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local Alias With Delimiter <alias1+test@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message existing-alias-recipient-delimiter.txt
Message-Id: <20220214195437.93CB115C52@mail.my-domain.com>

This is a test mail.

-------------------------------------------------------------------------------------
Debug: E-Mail content: /var/mail/localhost.localdomain/user1/new/1644868477.M928000P4368.mail.my-domain.com,S=1058,W=1083

Return-Path: <SRS0=OLIA=S5=external.tld=user@my-domain.com>
Delivered-To: user1@localhost.localdomain
Received: from mail.my-domain.com
	by mail.my-domain.com with LMTP
	id iOJJN32zCmIQEQAAUIhAew
	(envelope-from <SRS0=OLIA=S5=external.tld=user@my-domain.com>)
	for <user1@localhost.localdomain>; Mon, 14 Feb 2022 19:54:37 +0000
Received: from localhost (localhost [127.0.0.1])
	by mail.my-domain.com (Postfix) with ESMTP id E20F415C70
	for <user1@localhost.localdomain>; Mon, 14 Feb 2022 19:54:37 +0000 (UTC)
X-Virus-Scanned: Yes
X-Spam-Flag: NO
X-Spam-Score: 1.798
X-Spam-Level: *
X-Spam-Status: No, score=1.798 tagged_above=-5 required=2
	tests=[DKIM_ADSP_NXDOMAIN=0.8, HEADER_FROM_DIFFERENT_DOMAINS=1,
	NO_RECEIVED=-0.001, NO_RELAYS=-0.001] autolearn=no autolearn_force=no
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local User <alias1@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message existing-alias-external.txt
Message-Id: <20220214195437.6C1BD15C4B@mail.my-domain.com>

This is a test mail.

-------------------------------------------------------------------------------------
Debug: E-Mail content: /var/mail/localhost.localdomain/user1/new/1644868477.M435640P4368.mail.my-domain.com,S=2485,W=2549

Return-Path: <SRS0=EVkf=S5=mail.my-domain.com=postmaster@my-domain.com>
Delivered-To: user1@localhost.localdomain
Received: from mail.my-domain.com
	by mail.my-domain.com with LMTP
	id aeLvGX2zCmIQEQAAUIhAew
	(envelope-from <SRS0=EVkf=S5=mail.my-domain.com=postmaster@my-domain.com>)
	for <user1@localhost.localdomain>; Mon, 14 Feb 2022 19:54:37 +0000
Received: from localhost (localhost [127.0.0.1])
	by mail.my-domain.com (Postfix) with ESMTP id 645BF15C3C
	for <postmaster@my-domain.com>; Mon, 14 Feb 2022 19:54:37 +0000 (UTC)
Content-Type: multipart/mixed; boundary="----------=_1644868477-675-0"
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0
From: "Content-filter at mail.my-domain.com" <postmaster@mail.my-domain.com>
Date: Mon, 14 Feb 2022 19:54:37 +0000 (UTC)
Subject: VIRUS (Win.Test.EICAR_HDB-1) in mail FROM [127.0.0.1]:35742
 <SRS0=hjun=S5=external.tld=virus@my-domain.com>
To: <postmaster@my-domain.com>
Message-ID: <VAVO57UrVC_Rxf@mail.my-domain.com>

This is a multi-part message in MIME format...

------------=_1644868477-675-0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
Content-Transfer-Encoding: 7bit

A virus was found: Win.Test.EICAR_HDB-1

Scanner detecting a virus: ClamAV-clamd

Content type: Virus
Internal reference code for the message is 00675-01/VO57UrVC_Rxf

First upstream SMTP client IP address: [127.0.0.1] localhost

Return-Path: <SRS0=hjun=S5=external.tld=virus@my-domain.com>
From: Docker Mail Server <dockermailserver@external.tld>
Message-ID: <20220214195437.59A4A15C2F@mail.my-domain.com>
Subject: Test Message amavis-virus.txt
The message has been quarantined as: V/virus-VO57UrVC_Rxf

The message WAS NOT relayed to:
<user1@localhost.localdomain>:
   250 2.7.0 Ok, discarded, id=00675-01 - INFECTED: Win.Test.EICAR_HDB-1

Virus scanner output:
  /var/mail-state/lib-amavis/tmp/amavis-20220214T195437-00675-ddYx_SbB/parts/p001: Win.Test.EICAR_HDB-1 FOUND


------------=_1644868477-675-0
Content-Type: text/rfc822-headers; name="header.hdr"
Content-Disposition: inline; filename="header.hdr"
Content-Transfer-Encoding: 7bit
Content-Description: Message header section

Return-Path: <SRS0=hjun=S5=external.tld=virus@my-domain.com>
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local User <user1@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message amavis-virus.txt
Message-Id: <20220214195437.59A4A15C2F@mail.my-domain.com>

------------=_1644868477-675-0--
-------------------------------------------------------------------------------------
ok 1 checking accounts: listmailuser (quotas enabled) in 464ms

@georglauterbach
Copy link
Member

My output
Debug: * user1@localhost.localdomain ( 14K / ~ ) [0%]
Debug: E-Mail subjects -->
     1	/var/mail/localhost.localdomain/user1/new/1644873101.M43489P4463.mail.my-domain.com,S=804,W=822:Subject: Root Test Message
     2	/var/mail/localhost.localdomain/user1/new/1644873103.M10566P4463.mail.my-domain.com,S=1124,W=1150:Subject: Test Message existing-user-and-cc-local-alias.txt
     3	/var/mail/localhost.localdomain/user1/new/1644873098.M840497P4463.mail.my-domain.com,S=2492,W=2556:Subject: VIRUS (Win.Test.EICAR_HDB-1) in mail FROM [127.0.0.1]:55442
     4	/var/mail/localhost.localdomain/user1/new/1644873098.M840497P4463.mail.my-domain.com,S=2492,W=2556:Subject: Test Message amavis-virus.txt
     5	/var/mail/localhost.localdomain/user1/new/1644873098.M840497P4463.mail.my-domain.com,S=2492,W=2556:Subject: Test Message amavis-virus.txt
     6	/var/mail/localhost.localdomain/user1/new/1644873100.M788628P4463.mail.my-domain.com,S=1107,W=1132:Subject: Test Message existing-alias-recipient-delimiter.txt
     7	/var/mail/localhost.localdomain/user1/new/1644873101.M503017P4463.mail.my-domain.com,S=1050,W=1075:Subject: Test Message existing-user1.txt
     8	/var/mail/localhost.localdomain/user1/new/1644873104.M834089P4463.mail.my-domain.com,S=1001,W=1026:Subject: Test Message sieve-spam-folder.txt
     9	/var/mail/localhost.localdomain/user1/new/1644873104.M66125P4463.mail.my-domain.com,S=1057,W=1082:Subject: Test Message existing-catchall-local.txt
    10	/var/mail/localhost.localdomain/user1/new/1644873099.M780602P4463.mail.my-domain.com,S=1060,W=1085:Subject: Test Message existing-alias-external.txt
    11	/var/mail/localhost.localdomain/user1/new/1644873103.M819960P4520.mail.my-domain.com,S=1065,W=1090:Subject: Test Message existing-regexp-alias-local.txt
    12	/var/mail/localhost.localdomain/user1/.INBOX.spam/new/1644873104.M850713P4463.mail.my-domain.com,S=1001,W=1026:Subject: Test Message sieve-spam-folder.txt
    13	/var/mail/localhost.localdomain/user1/.Junk/new/1644873099.M886028P4463.mail.my-domain.com,S=1261,W=1289:Subject: SPAM: Test Message amavis-spam.txt

Debug: E-Mail content: /var/mail/localhost.localdomain/user1/new/1644873101.M43489P4463.mail.my-domain.com,S=804,W=822

Return-Path: <SRS0=4QkF=S5=mail.my-domain.com=root@my-domain.com>
Delivered-To: user1@localhost.localdomain
Received: from mail.my-domain.com
	by mail.my-domain.com with LMTP
	id UM6EAo3FCmJvEQAAUIhAew
	(envelope-from <SRS0=4QkF=S5=mail.my-domain.com=root@my-domain.com>)
	for <user1@localhost.localdomain>; Mon, 14 Feb 2022 21:11:41 +0000
Received: by mail.my-domain.com (Postfix)
	id 08E3C342D26; Mon, 14 Feb 2022 21:11:41 +0000 (UTC)
Delivered-To: root@mail.my-domain.com
Received: by mail.my-domain.com (Postfix, from userid 0)
	id F2F8D34311D; Mon, 14 Feb 2022 21:11:40 +0000 (UTC)
Subject: Root Test Message
Message-Id: <20220214211140.F2F8D34311D@mail.my-domain.com>
Date: Mon, 14 Feb 2022 21:11:40 +0000 (UTC)
From: root <SRS0=4QkF=S5=mail.my-domain.com=root@my-domain.com>

This is a test mail.
-------------------------------------------------------------------------------------
Debug: E-Mail content: /var/mail/localhost.localdomain/user1/new/1644873103.M10566P4463.mail.my-domain.com,S=1124,W=1150

Return-Path: <SRS0=XxhA=S5=external.tld=user@my-domain.com>
Delivered-To: user1@localhost.localdomain
Received: from mail.my-domain.com
	by mail.my-domain.com with LMTP
	id qHKPAI/FCmJvEQAAUIhAew
	(envelope-from <SRS0=XxhA=S5=external.tld=user@my-domain.com>)
	for <user1@localhost.localdomain>; Mon, 14 Feb 2022 21:11:43 +0000
Received: from localhost (localhost [127.0.0.1])
	by mail.my-domain.com (Postfix) with ESMTP id F3AA5342CF1
	for <user1@localhost.localdomain>; Mon, 14 Feb 2022 21:11:42 +0000 (UTC)
X-Virus-Scanned: Yes
X-Spam-Flag: NO
X-Spam-Score: 1.798
X-Spam-Level: *
X-Spam-Status: No, score=1.798 tagged_above=-5 required=2
	tests=[DKIM_ADSP_NXDOMAIN=0.8, HEADER_FROM_DIFFERENT_DOMAINS=1,
	NO_RECEIVED=-0.001, NO_RELAYS=-0.001] autolearn=no autolearn_force=no
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local User <user1@localhost.localdomain>
Cc: Existing Local Alias <alias2@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message existing-user-and-cc-local-alias.txt
Message-Id: <20220214211139.95B8F34311E@mail.my-domain.com>

This is a test mail.

-------------------------------------------------------------------------------------
Debug: E-Mail content: /var/mail/localhost.localdomain/user1/new/1644873098.M840497P4463.mail.my-domain.com,S=2492,W=2556

Return-Path: <SRS0=yQ5E=S5=mail.my-domain.com=postmaster@my-domain.com>
Delivered-To: user1@localhost.localdomain
Received: from mail.my-domain.com
	by mail.my-domain.com with LMTP
	id BtX0MYrFCmJvEQAAUIhAew
	(envelope-from <SRS0=yQ5E=S5=mail.my-domain.com=postmaster@my-domain.com>)
	for <user1@localhost.localdomain>; Mon, 14 Feb 2022 21:11:38 +0000
Received: from localhost (localhost [127.0.0.1])
	by mail.my-domain.com (Postfix) with ESMTP id B780B342D28
	for <postmaster@my-domain.com>; Mon, 14 Feb 2022 21:11:38 +0000 (UTC)
Content-Type: multipart/mixed; boundary="----------=_1644873098-1526-0"
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0
From: "Content-filter at mail.my-domain.com" <postmaster@mail.my-domain.com>
Date: Mon, 14 Feb 2022 21:11:38 +0000 (UTC)
Subject: VIRUS (Win.Test.EICAR_HDB-1) in mail FROM [127.0.0.1]:55442
 <SRS0=ucJ1=S5=external.tld=virus@my-domain.com>
To: <postmaster@my-domain.com>
Message-ID: <VAquebgL_HqFoQ@mail.my-domain.com>

This is a multi-part message in MIME format...

------------=_1644873098-1526-0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
Content-Transfer-Encoding: 7bit

A virus was found: Win.Test.EICAR_HDB-1

Scanner detecting a virus: ClamAV-clamd

Content type: Virus
Internal reference code for the message is 01526-01/quebgL_HqFoQ

First upstream SMTP client IP address: [127.0.0.1] localhost

Return-Path: <SRS0=ucJ1=S5=external.tld=virus@my-domain.com>
From: Docker Mail Server <dockermailserver@external.tld>
Message-ID: <20220214211138.17572342CF1@mail.my-domain.com>
Subject: Test Message amavis-virus.txt
The message has been quarantined as: q/virus-quebgL_HqFoQ

The message WAS NOT relayed to:
<user1@localhost.localdomain>:
   250 2.7.0 Ok, discarded, id=01526-01 - INFECTED: Win.Test.EICAR_HDB-1

Virus scanner output:
  /var/mail-state/lib-amavis/tmp/amavis-20220214T211138-01526-pUkvfYSm/parts/p001: Win.Test.EICAR_HDB-1 FOUND


------------=_1644873098-1526-0
Content-Type: text/rfc822-headers; name="header.hdr"
Content-Disposition: inline; filename="header.hdr"
Content-Transfer-Encoding: 7bit
Content-Description: Message header section

Return-Path: <SRS0=ucJ1=S5=external.tld=virus@my-domain.com>
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local User <user1@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message amavis-virus.txt
Message-Id: <20220214211138.17572342CF1@mail.my-domain.com>

------------=_1644873098-1526-0--
-------------------------------------------------------------------------------------
Debug: E-Mail content: /var/mail/localhost.localdomain/user1/new/1644873100.M788628P4463.mail.my-domain.com,S=1107,W=1132

Return-Path: <SRS0=XxhA=S5=external.tld=user@my-domain.com>
Delivered-To: user1~test@localhost.localdomain
Received: from mail.my-domain.com
	by mail.my-domain.com with LMTP
	id SB3uLozFCmJvEQAAUIhAew
	(envelope-from <SRS0=XxhA=S5=external.tld=user@my-domain.com>)
	for <user1~test@localhost.localdomain>; Mon, 14 Feb 2022 21:11:40 +0000
Received: from localhost (localhost [127.0.0.1])
	by mail.my-domain.com (Postfix) with ESMTP id BE7DF343120
	for <user1~test@localhost.localdomain>; Mon, 14 Feb 2022 21:11:40 +0000 (UTC)
X-Virus-Scanned: Yes
X-Spam-Flag: NO
X-Spam-Score: 1.798
X-Spam-Level: *
X-Spam-Status: No, score=1.798 tagged_above=-5 required=2
	tests=[DKIM_ADSP_NXDOMAIN=0.8, HEADER_FROM_DIFFERENT_DOMAINS=1,
	NO_RECEIVED=-0.001, NO_RELAYS=-0.001] autolearn=no autolearn_force=no
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local Alias With Delimiter <alias1+test@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message existing-alias-recipient-delimiter.txt
Message-Id: <20220214211138.A1AD9342D27@mail.my-domain.com>

This is a test mail.

-------------------------------------------------------------------------------------
Debug: E-Mail content: /var/mail/localhost.localdomain/user1/new/1644873101.M503017P4463.mail.my-domain.com,S=1050,W=1075

Return-Path: <SRS0=XxhA=S5=external.tld=user@my-domain.com>
Delivered-To: user1@localhost.localdomain
Received: from mail.my-domain.com
	by mail.my-domain.com with LMTP
	id wJfpHY3FCmJvEQAAUIhAew
	(envelope-from <SRS0=XxhA=S5=external.tld=user@my-domain.com>)
	for <user1@localhost.localdomain>; Mon, 14 Feb 2022 21:11:41 +0000
Received: from localhost (localhost [127.0.0.1])
	by mail.my-domain.com (Postfix) with ESMTP id 77F9D342D26
	for <user1@localhost.localdomain>; Mon, 14 Feb 2022 21:11:41 +0000 (UTC)
X-Virus-Scanned: Yes
X-Spam-Flag: NO
X-Spam-Score: 1.798
X-Spam-Level: *
X-Spam-Status: No, score=1.798 tagged_above=-5 required=2
	tests=[DKIM_ADSP_NXDOMAIN=0.8, HEADER_FROM_DIFFERENT_DOMAINS=1,
	NO_RECEIVED=-0.001, NO_RELAYS=-0.001] autolearn=no autolearn_force=no
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local User <user1@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message existing-user1.txt
Message-Id: <20220214211138.D29D9342CF1@mail.my-domain.com>

This is a test mail.

-------------------------------------------------------------------------------------
Debug: E-Mail content: /var/mail/localhost.localdomain/user1/new/1644873104.M834089P4463.mail.my-domain.com,S=1001,W=1026

Return-Path: <SRS0=XxhA=S5=external.tld=user@my-domain.com>
Delivered-To: user1@localhost.localdomain
Received: from mail.my-domain.com
	by mail.my-domain.com with LMTP
	id eF+mMZDFCmJvEQAAUIhAew
	(envelope-from <SRS0=XxhA=S5=external.tld=user@my-domain.com>)
	for <user1@localhost.localdomain>; Mon, 14 Feb 2022 21:11:44 +0000
Received: from localhost (localhost [127.0.0.1])
	by mail.my-domain.com (Postfix) with ESMTP id C9B70342CE9
	for <user1@localhost.localdomain>; Mon, 14 Feb 2022 21:11:44 +0000 (UTC)
X-Virus-Scanned: Yes
X-Spam-Flag: NO
X-Spam-Score: 0.998
X-Spam-Level:
X-Spam-Status: No, score=0.998 tagged_above=-5 required=2
	tests=[HEADER_FROM_DIFFERENT_DOMAINS=1, NO_RECEIVED=-0.001,
	NO_RELAYS=-0.001] autolearn=no autolearn_force=no
From: Spambot <spam@spam.com>
To: Existing Local User <alias2@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message sieve-spam-folder.txt
Message-Id: <20220214211140.5F53134311F@mail.my-domain.com>

This is a test mail.

-------------------------------------------------------------------------------------
Debug: E-Mail content: /var/mail/localhost.localdomain/user1/new/1644873104.M66125P4463.mail.my-domain.com,S=1057,W=1082

Return-Path: <SRS0=XxhA=S5=external.tld=user@my-domain.com>
Delivered-To: user1@localhost.localdomain
Received: from mail.my-domain.com
	by mail.my-domain.com with LMTP
	id 6LzeA5DFCmJvEQAAUIhAew
	(envelope-from <SRS0=XxhA=S5=external.tld=user@my-domain.com>)
	for <user1@localhost.localdomain>; Mon, 14 Feb 2022 21:11:44 +0000
Received: from localhost (localhost [127.0.0.1])
	by mail.my-domain.com (Postfix) with ESMTP id 0D242342CE9
	for <user1@localhost.localdomain>; Mon, 14 Feb 2022 21:11:44 +0000 (UTC)
X-Virus-Scanned: Yes
X-Spam-Flag: NO
X-Spam-Score: 1.798
X-Spam-Level: *
X-Spam-Status: No, score=1.798 tagged_above=-5 required=2
	tests=[DKIM_ADSP_NXDOMAIN=0.8, HEADER_FROM_DIFFERENT_DOMAINS=1,
	NO_RECEIVED=-0.001, NO_RELAYS=-0.001] autolearn=no autolearn_force=no
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local User <wildcard@localdomain2.com>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message existing-catchall-local.txt
Message-Id: <20220214211140.30E1234311C@mail.my-domain.com>

This is a test mail.

-------------------------------------------------------------------------------------
Debug: E-Mail content: /var/mail/localhost.localdomain/user1/new/1644873099.M780602P4463.mail.my-domain.com,S=1060,W=1085

Return-Path: <SRS0=XxhA=S5=external.tld=user@my-domain.com>
Delivered-To: user1@localhost.localdomain
Received: from mail.my-domain.com
	by mail.my-domain.com with LMTP
	id sL52LovFCmJvEQAAUIhAew
	(envelope-from <SRS0=XxhA=S5=external.tld=user@my-domain.com>)
	for <user1@localhost.localdomain>; Mon, 14 Feb 2022 21:11:39 +0000
Received: from localhost (localhost [127.0.0.1])
	by mail.my-domain.com (Postfix) with ESMTP id BBEB334311C
	for <user1@localhost.localdomain>; Mon, 14 Feb 2022 21:11:39 +0000 (UTC)
X-Virus-Scanned: Yes
X-Spam-Flag: NO
X-Spam-Score: 1.798
X-Spam-Level: *
X-Spam-Status: No, score=1.798 tagged_above=-5 required=2
	tests=[DKIM_ADSP_NXDOMAIN=0.8, HEADER_FROM_DIFFERENT_DOMAINS=1,
	NO_RECEIVED=-0.001, NO_RELAYS=-0.001] autolearn=no autolearn_force=no
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local User <alias1@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message existing-alias-external.txt
Message-Id: <20220214211138.44B80342D21@mail.my-domain.com>

This is a test mail.

-------------------------------------------------------------------------------------
Debug: E-Mail content: /var/mail/localhost.localdomain/user1/new/1644873103.M819960P4520.mail.my-domain.com,S=1065,W=1090

Return-Path: <SRS0=XxhA=S5=external.tld=user@my-domain.com>
Delivered-To: user1@localhost.localdomain
Received: from mail.my-domain.com
	by mail.my-domain.com with LMTP
	id gC3CMI/FCmKoEQAAUIhAew
	(envelope-from <SRS0=XxhA=S5=external.tld=user@my-domain.com>)
	for <user1@localhost.localdomain>; Mon, 14 Feb 2022 21:11:43 +0000
Received: from localhost (localhost [127.0.0.1])
	by mail.my-domain.com (Postfix) with ESMTP id C5300342CF1
	for <user1@localhost.localdomain>; Mon, 14 Feb 2022 21:11:43 +0000 (UTC)
X-Virus-Scanned: Yes
X-Spam-Flag: NO
X-Spam-Score: 1.798
X-Spam-Level: *
X-Spam-Status: No, score=1.798 tagged_above=-5 required=2
	tests=[DKIM_ADSP_NXDOMAIN=0.8, HEADER_FROM_DIFFERENT_DOMAINS=1,
	NO_RECEIVED=-0.001, NO_RELAYS=-0.001] autolearn=no autolearn_force=no
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local User <test123@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message existing-regexp-alias-local.txt
Message-Id: <20220214211140.031D6342CE9@mail.my-domain.com>

This is a test mail.

-------------------------------------------------------------------------------------
Debug: E-Mail content: /var/mail/localhost.localdomain/user1/.INBOX.spam/new/1644873104.M850713P4463.mail.my-domain.com,S=1001,W=1026

Return-Path: <SRS0=XxhA=S5=external.tld=user@my-domain.com>
Delivered-To: user1@localhost.localdomain
Received: from mail.my-domain.com
	by mail.my-domain.com with LMTP
	id eF+mMZDFCmJvEQAAUIhAew
	(envelope-from <SRS0=XxhA=S5=external.tld=user@my-domain.com>)
	for <user1@localhost.localdomain>; Mon, 14 Feb 2022 21:11:44 +0000
Received: from localhost (localhost [127.0.0.1])
	by mail.my-domain.com (Postfix) with ESMTP id C9B70342CE9
	for <user1@localhost.localdomain>; Mon, 14 Feb 2022 21:11:44 +0000 (UTC)
X-Virus-Scanned: Yes
X-Spam-Flag: NO
X-Spam-Score: 0.998
X-Spam-Level:
X-Spam-Status: No, score=0.998 tagged_above=-5 required=2
	tests=[HEADER_FROM_DIFFERENT_DOMAINS=1, NO_RECEIVED=-0.001,
	NO_RELAYS=-0.001] autolearn=no autolearn_force=no
From: Spambot <spam@spam.com>
To: Existing Local User <alias2@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: Test Message sieve-spam-folder.txt
Message-Id: <20220214211140.5F53134311F@mail.my-domain.com>

This is a test mail.

-------------------------------------------------------------------------------------
Debug: E-Mail content: /var/mail/localhost.localdomain/user1/.Junk/new/1644873099.M886028P4463.mail.my-domain.com,S=1261,W=1289

Return-Path: <SRS0=zpda=S5=external.tld=spam@my-domain.com>
Delivered-To: user1@localhost.localdomain
Received: from mail.my-domain.com
	by mail.my-domain.com with LMTP
	id iHLBNIvFCmJvEQAAUIhAew
	(envelope-from <SRS0=zpda=S5=external.tld=spam@my-domain.com>)
	for <user1@localhost.localdomain>; Mon, 14 Feb 2022 21:11:39 +0000
Received: from localhost (localhost [127.0.0.1])
	by mail.my-domain.com (Postfix) with ESMTP id D564A34311C
	for <user1@localhost.localdomain>; Mon, 14 Feb 2022 21:11:39 +0000 (UTC)
X-Quarantine-ID: <n09A3Ls7KeRS>
X-Virus-Scanned: Yes
X-Spam-Flag: YES
X-Spam-Score: 1001.799
X-Spam-Level: ****************************************************************
X-Spam-Status: Yes, score=1001.799 tagged_above=-5 required=2
	tests=[DKIM_ADSP_NXDOMAIN=0.8, GTUBE=1000,
	HEADER_FROM_DIFFERENT_DOMAINS=1, NO_RECEIVED=-0.001, NO_RELAYS=-0.001,
	TVD_SPACE_RATIO=0.001] autolearn=no autolearn_force=no
From: Docker Mail Server <dockermailserver@external.tld>
To: Existing Local User <user1@localhost.localdomain>
Date: Sat, 22 May 2010 07:43:25 -0400
Subject: SPAM: Test Message amavis-spam.txt
Message-Id: <20220214211137.D7F0B342CE9@mail.my-domain.com>

This is a test mail.
XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X

-------------------------------------------------------------------------------------

Had a quick look in KDiff3, but nothing that caught my eye. Using du to determine the size of the log output yields nearly the same size for both. I have no idea why the changes introduced in this PR cause the test to sporadically fail...

@georglauterbach
Copy link
Member

georglauterbach commented Feb 14, 2022

I just noticed we would actually need to set SPAMASSASSIN_SPAM_TO_INBOX=0 in test/tests.bats to run the tests as they used to run - this could indeed make a difference, if were at the edge of something here, (right?). But running it locally, I fall from 14K to 12K, which is wrong again 😆 I will enable it nevertheless and see what out CI has to say about that.

EDIT: Woah, nevermind! It was 12K to begin with!!! :D It seems as if I found the cause :D
EDIT 2: So tests are going to fail now, which is expected. We can revert the changes to test/tests.bats concerning these messages: # TODO add a test covering case SPAMASSASSIN_SPAM_TO_INBOX=0 and add instead: # TODO add a test covering case SPAMASSASSIN_SPAM_TO_INBOX=1 for the future. @docker-mailserver/maintainers @casperklein what do you think about that? I'd go ahead and do it (reverting tests to run at initial state) :D

@wernerfred
Copy link
Member

EDIT: Woah, nevermind! It was 12K to begin with!!! :D It seems as if I found the cause :D

I can't follow you. Can you explain it again with more details to follow along?

@casperklein
Copy link
Member

I just noticed we would actually need to set SPAMASSASSIN_SPAM_TO_INBOX=0 in test/tests.bats to run the tests as they used to run

Damn it, I thought this was already done (but haven't checked it). That's why I was curious, why the test is failing now.

I can't follow you

Same here 😄

@georglauterbach
Copy link
Member

Alright, here is the longer explanation: we were looking for the issue in the wrong place.

This PR adjusts the default value of SPAMASSASSIN_SPAM_TO_INBOX to 1. But the mail container used in test/tests.bats was not adjusted to use the original SPAMASSASSIN_SPAM_TO_INBOX=0 environment, so this PR actually changed the behavior of the tested containers but we did not adjust the test cases accordingly.

Hence, one test failed randomly: assert_output '* user1@localhost.localdomain ( 12K / ~ ) [0%]' failed (mismatch in output, the quota value 12K was not okay). This is actually correct. So the PR went on to change this value to what was locally seen as a reliable value for the quota (13K it was I believe). But as the comments above show, this is in fact not the case, as there is for example a discrepancy between @casperklein's and my runs.

But then I noticed that we need to set SPAMASSASSIN_SPAM_TO_INBOX=0 manually now. Tests were still failing for me locally because I still used 14K as the value (which I thought was wrong, and indeed it was). But looking at master, and the diff of this PR, I realized the original quota value was 12K, not 13K or 14K (what @casperklein and I tested with). So by changing it back to 12K, we obtain the actually correct behavior again - problem solved.

I'd keep the original behavior (SPAMASSASSIN_SPAM_TO_INBOX=0 and 12K for the quota). I'd go ahead and adjust the PR accordingly so we can go ahead and merge this afterwards without having to fiddle with the tests.

@github-actions
Copy link
Contributor

Documentation preview for this PR is ready! 🎉

Built with commit: ade42a3

@georglauterbach
Copy link
Member

I adjusted the 4 lines in test/tests.bats accordingly (to the old values respectively). CI passes with these value for me locally. If you have a look at the file, all should make sense. (Let's hope CI passes on GitHub and there is no other problem I haven't thought of.)

@georglauterbach
Copy link
Member

Interesting test failure that has (most likely) nothing to do with the PR itself: looking at the failures of #2404 and this PR (#2361), the same (unrelated) problem occurs. I will restart the tests.

-e ENABLE_SRS=1 \
-e ENABLE_UPDATE_CHECK=0 \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that is necessary, because there will never be a new version, hence no e-mail notification about an update. But it doesn't hurt, so leave it as it is if you like.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was added by @craue, and you're right, probably not necessary. I will note this and remove this with an upcoming PR of mine. Remind me if I forget about it :)

@georglauterbach georglauterbach merged commit 908e95f into docker-mailserver:master Feb 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/configuration (file) area/scripts kind/improvement Improve an existing feature, configuration file or the documentation stale-bot/ignore Indicates that this issue / PR shall not be closed by our stale-checking CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants