On 28/02/2019 22.38, Bill Cole wrote:
On 28 Feb 2019, at 0:55, Thomas Seilund wrote:

On 27/02/2019 23.50, John Fawcett wrote:
On 27/02/2019 17:56, Thomas Seilund wrote:
Hi All,

I run a mail server with Postfix (version 2.6.6), Dovecot and
Spamassassin.

The first time I saw an unexpected directory in virtual_mailbox_base
what medio dec. 2018. The mail server has been running for 5+ years.

There are more directories than the six directories I expect. I expect
one directory for each of the domains that the mail server handles.
What were the directories that you did not expect?

/mnt/ebs01/vmail/landplan.dk is one if the directories that I do not expect.

Because landsplan.dk is not a local domain on the the mail server

I'm guessing: is it the domain of the intended (non-local) recipient?
Yes, you are right

Looking at the /var/log/maillog it seems as if:

1. An user that is handled by the mail server logs in and sends a mail
to an address that is not handled by the mail server

2. The mail is queued

3. Spamassassin kicks in and scans the mail. I don't understand that
as the mail is outgoing.
You can scan outgoing mail if you want to make sure your users don't
send viruses. Even though I trust all my users I do it as a precaution
in case some users clients get infected and start sending viruses.
Perhaps Spamassassin creates the unexpected directory as the
Spamassassin line in /var/log/maillog refers to an unexpected file,
ie. /mnt/ebs01/vmail/landplan.dk/XXX/SpamAssassin/user_prefs. By the
way, that file does not exist.

Guessing: XXX is the local part of the intended recipient?
Yes, you are right

Depending on its configuration, SpamAssassin may create a per-user configuration directory (by default, ~/.spamassassin/, but it can be set to ~/SpamAssassin/ or anything else you choose) for whatever user for whom it believes it is scanning a message. For virtual users, the expansion of "~" is configurable as well and typically looks like

What I THINK is happening is that you have hooked into SpamAssassin in such a way that it is being told unconditionally that it should use the per-user preferences of the recipient of the message.  I think your goal should be to either make SA scan outbound without per-user configurations or to  not scan outbound at all. Because the plumbing between Postfix and SA can vary greatly (standalone milter, MIMEDefang, Amavis as a milter, Amavis as a SMTP proxy, content_filter, pipe to spamc...) I won't try to guess what your specific fix is. How have you configured Postfix to pass messages to SpamAssassin?

It might be useful to also ask this question on the SpamAssassin-Users mailing list, as the actual directory creation is almost certainly being done by SA. However, how exactly you fix it is very much a Postfix question because Postfix is giving SA the recipient address as a user who needs a preferences directory of their own.

It was never my intention to let SA scan outgoing messages.

I followed this guide when I set up SA - https://wiki.apache.org/spamassassin/IntegratedSpamdInPostfix

I have added these two lines to postfix master.cf:

smtp      inet  n       -       n       -       -       smtpd -o content_filter=spamfilter -o receive_override_options=no_address_mappings spamfilter    unix  -       n       n       -       -       pipe flags=Rq user=vmail argv=/usr/bin/spamfilter.sh -oi -f ${sender} ${recipient}

Furthermore, I have this script in /usr/bin/spamfilter:

#!/bin/bash
SENDMAIL=/usr/sbin/sendmail
SPAMASSASSIN=/usr/bin/spamc
RECEIVER=`echo $4 | tr '[:upper:]' '[:lower:]'`
${SPAMASSASSIN} -u $RECEIVER | ${SENDMAIL} "$@"
exit $?

Finally, this is the parameters I have for SA in file /etc/sysconfig/spamassassin:

SPAMDOPTIONS="--daemonize --create-prefs --max-children=5 --helper-home-dir=/mnt/ebs01/vmail/%d/%l/SpamAssassin --username=vmail --nouser-config --virtual-config-dir=/mnt/ebs01/vmail/%d/%l/SpamAssassin"
export PYTHONPATH=/usr/lib/python2.6/site-packages


--
Bill Cole
b...@scconsult.com or billc...@apache.org
(AKA @grumpybozo and many *@billmail.scconsult.com addresses)
Available For Hire: https://linkedin.com/in/billcole

Reply via email to