You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by mgia <mg...@lavabit.com> on 2012/10/15 15:23:30 UTC

Spamassassin sync in 2 servers?

Hello list,


Since the mail server and the web mail frontend are located in different
servers I was wondering how I sync 2 Spamaassassin databases?

Thank you.

-
mgia




Re: Spamassassin sync in 2 servers?

Posted by Robert Schetterer <ro...@schetterer.org>.
Am 15.10.2012 15:30, schrieb mgia:
>> which server is in charge of content filter? both of them?
> Yes, both of them.
> 
> 
use spamassassin mysql setup, as described in the faqs i.e master and
two slaves etc, bayes sql may not be ideal

-- 
Best Regards
MfG Robert Schetterer

Re: Spamassassin sync in 2 servers?

Posted by mgia <mg...@lavabit.com>.
Thank you for posting this Christopher.

I appreciate it!

-
mgia



Re: Spamassassin sync in 2 servers?

Posted by Chris Hunt <dh...@gmail.com>.
On 10/17/2012 8:27 AM, Kris Deugau wrote:
> Chris Hunt wrote:
>> Greetings,
>>     Once upon a time, at $dayjob we had a similar problem.  We used the
>> mark-as-junk-2 plugin to move all marked messages to a folder outside
>> the user's mail base.
> Did this train a per-user Bayes, or global?
>
> How many users did you then have complaining about legitimate mail going
> missing?
>
> We hand-sort all reports before letting sa-learn get at the messages,
> because we have ongoing issues with people regularly reporting their
> entire Inbox, legitimate mail or not - and in spite of a patch for a
> Javascript popup that explicitly asks if they want to report things as
> spam.  :/
>
> In our case, with a global Bayes, it's probably more important on a
> systemwide basis to hand-sort first since bad training will affect
> everyone...
>
> -kgd
it was per-user bayes and we had no complaints.  Some folks do over- or
mis-report, yeah and we periodically audited and notified them.  Care to
share that Javascript popup?

-Christopher

Re: Spamassassin sync in 2 servers?

Posted by Kris Deugau <kd...@vianet.ca>.
Chris Hunt wrote:
> Greetings,
>     Once upon a time, at $dayjob we had a similar problem.  We used the
> mark-as-junk-2 plugin to move all marked messages to a folder outside
> the user's mail base.

Did this train a per-user Bayes, or global?

How many users did you then have complaining about legitimate mail going
missing?

We hand-sort all reports before letting sa-learn get at the messages,
because we have ongoing issues with people regularly reporting their
entire Inbox, legitimate mail or not - and in spite of a patch for a
Javascript popup that explicitly asks if they want to report things as
spam.  :/

In our case, with a global Bayes, it's probably more important on a
systemwide basis to hand-sort first since bad training will affect
everyone...

-kgd

Re: Spamassassin sync in 2 servers?

Posted by Chris Hunt <dh...@gmail.com>.
On 10/17/2012 3:59 AM, mgia wrote:
> Hi,
>> if you choose "IMAP movement", when users marks as spam/ham messages
>> are moved to special folders where system learns from.
> In my understanding this would be an overkill since there should be a
> need for a second mail storage, not really practical for thousands of
> users..
>
> It got to be a more efficient way!
>
>
>
>
Greetings,
    Once upon a time, at $dayjob we had a similar problem.  We used the
mark-as-junk-2 plugin to move all marked messages to a folder outside
the user's mail base.  We include the user's address and the reported
message status in the file-name (e.g. --user@example.com--spam--yEY0yb):

[root@mail plugins]# cat markasjunk2/config.inc.php | grep -v -F '//'
<?php

/**
 * MarkAsJunk2 configuration file
 */
$rcmail_config['markasjunk2_learning_driver'] = dir_learn;
$rcmail_config['markasjunk2_spam_flag'] = 'Junk';
$rcmail_config['markasjunk2_ham_flag'] = null;
$rcmail_config['markasjunk2_spam_cmd'] = '/usr/bin/sa-learn --spam
--username=%u %f';
$rcmail_config['markasjunk2_ham_cmd'] = '/usr/bin/sa-learn --ham
--username=%u %f';
$rcmail_config['markasjunk2_spam_dir'] = '/.../temp/reported';
$rcmail_config['markasjunk2_ham_dir'] = '/.../temp/reported';
$rcmail_config['markasjunk2_filename'] = '--%u--%t--';
$rcmail_config['markasjunk2_email_attach'] = true;
$rcmail_config['markasjunk2_email_subject'] = '[REPORTED %t]';
?>


Then we use a cron job to train on that folder:

[root@mail01 plugins]# cat /.../sa-learn-from-folder
#!/usr/bin/env bash
# sa-learn-from-folder.sh
# Ver. 0.1

# Runs sa-learn against files marked as ham or spam by webmail users
# /.../temp/reported
# file name like [REPORTED_spam_by_user\@example.com-\]kPvVL2
# Usage: $0

# Test if there are any files in the directory.  If there are, go ahead

if [ ! -z "$(ls -a $FILES)" ];  then
for f in $FILES
do
  echo $(date)
  echo "Processing $f file..."
  USERNAME=`echo $f  | awk 'BEGIN { FS = "--" } ; { print $2 }'`
  TYPE=`echo $f  | awk 'BEGIN { FS = "--" } ; { print $3 }'`
  echo "username = $USERNAME"
  echo "type = $TYPE"
# Somehow we need to grab just the files name, not the complete path
  mv -f $f /tmp/
  fileName=$(basename $f)
 echo "fileName = $fileName"
 tmpFile="/tmp/$fileName"
 echo "tmpFile = $tmpFile"
 time  /usr/bin/sa-learn  --username="$USERNAME" --$TYPE ""$tmpFile""
  rm -f ""$tmpFile""
  echo "removed $tmpFile"
  echo "*****************************************"
done

# Otherwise, the directory is empty.  Print that and bail
else
                echo "NOTHING TO DO.  The directory $FILES is empty"
fi



Hope that helps,
Christopher Hunt

Re: Spamassassin sync in 2 servers?

Posted by mgia <mg...@lavabit.com>.
Hi,
> if you choose "IMAP movement", when users marks as spam/ham messages
> are moved to special folders where system learns from.
In my understanding this would be an overkill since there should be a
need for a second mail storage, not really practical for thousands of
users..

It got to be a more efficient way!





Re: Spamassassin sync in 2 servers?

Posted by Christian Grunfeld <ch...@gmail.com>.
if you choose "IMAP movement", when users marks as spam/ham messages
are moved to special folders where system learns from.

if you choose "report by email" messages reported as spam/ham are sent
to special catchall accounts.


2012/10/16 Christian Grunfeld <ch...@gmail.com>:
> I said it is possible moving messages by IMAP or by email reporting
> ..... and not possible moving messages at filesystem level (in the
> case webmail is separate from mail server)
>
> Plugins can do all of them. You have to choose what fit best for you.
>
>
> 2012/10/16 mgia <mg...@lavabit.com>:
>>> roundcube and many others have plugins that can move messages by IMAP,
>>> at filesystem level (not usefull if frontend is separate from
>>> mailboxes) and by "report by mail"
>> Sorry, I haven't understand you, do you mean that this is not possible?
>>
>>

Re: Spamassassin sync in 2 servers?

Posted by Christian Grunfeld <ch...@gmail.com>.
I said it is possible moving messages by IMAP or by email reporting
..... and not possible moving messages at filesystem level (in the
case webmail is separate from mail server)

Plugins can do all of them. You have to choose what fit best for you.


2012/10/16 mgia <mg...@lavabit.com>:
>> roundcube and many others have plugins that can move messages by IMAP,
>> at filesystem level (not usefull if frontend is separate from
>> mailboxes) and by "report by mail"
> Sorry, I haven't understand you, do you mean that this is not possible?
>
>

Re: Spamassassin sync in 2 servers?

Posted by mgia <mg...@lavabit.com>.
> roundcube and many others have plugins that can move messages by IMAP,
> at filesystem level (not usefull if frontend is separate from
> mailboxes) and by "report by mail"
Sorry, I haven't understand you, do you mean that this is not possible?



Re: Spamassassin sync in 2 servers?

Posted by Christian Grunfeld <ch...@gmail.com>.
roundcube and many others have plugins that can move messages by IMAP,
at filesystem level (not usefull if frontend is separate from
mailboxes) and by "report by mail"


2012/10/16 mgia <mg...@lavabit.com>:
> Hi,
>> How do you spread transport, recipients mailboxes and web client
>> between your servers?
>>
>> if you have SMTP and recipient mailboxes in one box you have to filter
>> only there !
>
> In the case that the web mail interface (ex. roundcube) is running in a
> separate server as of the mail server, how can a user mark messages as
> spam/ham from the web mail interface?
>
> -
> mgia
>
>
>

Re: Spamassassin sync in 2 servers?

Posted by mgia <mg...@lavabit.com>.
Hi,
> How do you spread transport, recipients mailboxes and web client
> between your servers?
> 
> if you have SMTP and recipient mailboxes in one box you have to filter
> only there !

In the case that the web mail interface (ex. roundcube) is running in a
separate server as of the mail server, how can a user mark messages as
spam/ham from the web mail interface?

-
mgia




Re: Spamassassin sync in 2 servers?

Posted by Christian Grunfeld <ch...@gmail.com>.
How do you spread transport, recipients mailboxes and web client
between your servers?

if you have SMTP and recipient mailboxes in one box you have to filter
only there !


2012/10/15 mgia <mg...@lavabit.com>:
>> which server is in charge of content filter? both of them?
> Yes, both of them.
>
>

Re: Spamassassin sync in 2 servers?

Posted by mgia <mg...@lavabit.com>.
> which server is in charge of content filter? both of them?
Yes, both of them.



Re: Spamassassin sync in 2 servers?

Posted by Christian Grunfeld <ch...@gmail.com>.
which server is in charge of content filter? both of them?

2012/10/15 mgia <mg...@lavabit.com>:
> Hello list,
>
>
> Since the mail server and the web mail frontend are located in different
> servers I was wondering how I sync 2 Spamaassassin databases?
>
> Thank you.
>
> -
> mgia
>
>
>

Re: Spamassassin sync in 2 servers?

Posted by mgia <mg...@lavabit.com>.
> I assume that by 'Spamassassin database' you mean the Bayes and/or
> user-specific items. 
> 
> If you're using SA configured as a separate spamc/spamd client/server
> arrangement for the MTA and web mail server, just change the
> configuration so that all spamc clients talk to a single instance spamd
> SA server. 
> 
> OTOH, if you're using Amavis to interface SA to your MTA, then about all
> you can do is to use a MySQL database to host the Bayes and
> user-specific data. This can be located on any machine that the MTA and
> webmail front end can both access.

I would like to use the following plugin
https://github.com/JohnDoh/Roundcube-Plugin-Mark-as-Junk-2 in Roundcube.

Can sa-learn configured in such a way? AFAIK sa-learn needs access to
the mail's user folder. 

Thank you for the responses!

-
mgia



Re: Spamassassin sync in 2 servers?

Posted by Martin Gregorie <ma...@gregorie.org>.
On Mon, 2012-10-15 at 15:23 +0200, mgia wrote:
> Hello list,
> 
> 
> Since the mail server and the web mail frontend are located in different
> servers I was wondering how I sync 2 Spamaassassin databases?
> 
I assume that by 'Spamassassin database' you mean the Bayes and/or
user-specific items. 

If you're using SA configured as a separate spamc/spamd client/server
arrangement for the MTA and web mail server, just change the
configuration so that all spamc clients talk to a single instance spamd
SA server. 

OTOH, if you're using Amavis to interface SA to your MTA, then about all
you can do is to use a MySQL database to host the Bayes and
user-specific data. This can be located on any machine that the MTA and
webmail front end can both access.


Martin