Page 1 of 1

Qmail Scanner, SpamAssassin & PSA-Spamassassin

Posted: Wed Jul 14, 2010 6:01 pm
by thebitworks
Hi All,

I am running a Plesk 8.6 box (Centos 5) with qmail, qmail-scanner, spamassassin (art), clamav and psa-spamassassin and having some difficulties with weirdness that seems to be caused by psa-spamassassin.

The reason we added psa-spamassassin was that we had a few users that wanted to set their own spam filter settings (which seems to be working).

The strange behavior is as follows:
-trying to have spamd log to a separate file and it just won't use the option. Does not matter if I add it in the qmail-scanner.ini or in /etc/sysconfig/spamassassin spamdoptions. If I uninstall psa-spamassassin it seems to work just fine and logs to the separate file, so psa-spamassassin seems to be ignoring what is placed in either of these files.
-spamd never seems to spawn more than 2 children in spite of the fact it is configed for 5.

A side issue, as I don't think this is related to psa-spamassassin is that for the first time ever, we are getting outbound e-mails sent by our clients marked as spam. (If we whitelist (in local.cf) them, that seems to take care of it but is there a better option - we have several hundred different domains we would have to whitelist. I was actually going to try to configure the logging to a separate file to do some debugging when I noticed the above issues showing up.

Is there a proper way to set up qmail-scanner with psa-spamassassin, that I am missing? I followed some directions posted in this forum that were confirmed by some additional sites found in searching the Internet.

Any help, tips or pointers would be much appreciated.

Re: Qmail Scanner, SpamAssassin & PSA-Spamassassin

Posted: Wed Jul 14, 2010 6:17 pm
by breun
qmail-scanner and psa-spamassassin don't integrate AFAIK (we don't use psa-spamassassin). If you're using both, e-mail is getting processed by SpamAssassin twice, in two different setups/configurations. SpamAssassin under qmail-scanner is also used for outbound mail.

Re: Qmail Scanner, SpamAssassin & PSA-Spamassassin

Posted: Wed Jul 14, 2010 6:20 pm
by thebitworks
Actually in respect to getting processed 2X, we have not see that happening at all. Logs indicate the messages get processed 1 time only by spamd, the question really seems to be is psa's spamd using the correct options file.

Re: Qmail Scanner, SpamAssassin & PSA-Spamassassin

Posted: Wed Jul 14, 2010 6:24 pm
by breun
I don't know about psa-spamassassin. I do know that for SpamAssassin via qmail-scanner you'll want to edit SA_SETTINGS in /etc/qmail-scanner.ini and then run qmail-scanner-reconfigure.

Re: Qmail Scanner, SpamAssassin & PSA-Spamassassin

Posted: Wed Jul 14, 2010 6:28 pm
by thebitworks
Yes, we have updated the settings in both qmail-scanner.in and in /etc/sysconfig/spamassassin

This is the qmail-scanner.ini file line:
SA_SETTINGS="-d -c -m5 -H --syslog=/var/log/spamd.log"

And this is the /etc/sysconfig/spamassassin file:
SPAMDOPTIONS="-d -c -m5 -H --syslog=/var/log/spamd.log"

When we simply run spamassassin (after removing psa-spamassassin), this works fine, logs to the proper file, it runs 5 children, etc.
When we reinstall psa-spamassassin, the line seems to be completely ignored. Somewhere plesk is inserting some different spamd options and we can't seem to figure out where they are.

Re: Qmail Scanner, SpamAssassin & PSA-Spamassassin

Posted: Thu Jul 15, 2010 11:37 am
by thebitworks
I finally figured this out and thought I would post the information I found out here, as it may be helpful to someone in the future.

psa-spamassassin reads its options from the psa database in mysql. Changing max children can be done there by simply updating the variable spamfilter_max_children and then restarting spamassassin.

However, there were no options in there for log file, debugging etc. - I guess the folks at Plesk figure we don't or would not possibly need them.

Anyway, to get the log to go where I needed it I did the following:

vi /usr/bin/spamd

:s/spamd.log - that gets you near the default logging definition
find and change my $log_facility = $opt{'syslog'} || 'mail'; to my $log_facility = $opt{'syslog'} || 'file';
a few lines down from there:
find and change my $log_file = "spamd.log"; to my $log_file = "full path and filename of where you want the log"; (make sure that popuser can write to it)

This will continue to work until spamassassin or psa-spamassassin gets updated, then you need to do it again.

As for other options that plesk sets you can do the following:

ps -AF |grep spamd and see what options plesk starts spamd with, those you probably can't modify (well you could, but you would really have to hack on spamd)

I would suspect you could modify spamd to simply default to any other options you might need to run.

Another way to modify how it runs (at least until a psa-spamassassin restart is):
ps -AF |grep spamd
You will get something like:
/usr/bin/spamd --username=popuser --daemonize --nouser-config --helper-home-dir=/var/qmail --max-children 7 --create-prefs --virtual-config-dir=/var/qmail/mailnames/%d/%l/.spamassassin --pidfile=/var/run/spamd/spamd_full.pid --socketpath=/tmp/spamd_full.sock

Then you can simply do a killall -9 spamd

Then paste the command line back out there with your additional or replacement options and restart it. In my case, I simply wanted to start it with --debug=all to check on another problem so I pasted this:

/usr/bin/spamd --username=popuser --daemonize --nouser-config --helper-home-dir=/var/qmail --max-children 7 --create-prefs --virtual-config-dir=/var/qmail/mailnames/%d/%l/.spamassassin --pidfile=/var/run/spamd/spamd_full.pid --socketpath=/tmp/spamd_full.sock --debug=all

and it works great.