Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Spamassassin + Amavis-new
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Strowi
l33t
l33t


Joined: 19 Aug 2003
Posts: 656
Location: Bonn

PostPosted: Fri Jan 06, 2006 11:18 am    Post subject: Spamassassin + Amavis-new Reply with quote

hi,

i've got a small problem with amavisd + spamassassin.

My setup looks like this:
postfix-> amavisd-new -> spamassassin/clamav -> cyrus-imapd
Code:

yggdrasill strowi # emerge -pv postfix spamassassin cyrus-sasl cyrus-imapd amavisd-new
[ebuild   R   ] mail-mta/postfix-2.2.5  -hardened -ipv6 -ldap -mailwrapper -mbox -mysql -nis +pam -postgres +sasl (-selinux) +ssl -vda 0 kB
[ebuild   R   ] mail-filter/spamassassin-3.1.0-r2  +berkdb -doc -mysql -postgres -qmail -spf -sqlite +ssl -tools 0 kB
[ebuild   R   ] dev-libs/cyrus-sasl-2.1.20  -authdaemond -berkdb* -gdbm -java -kerberos -ldap -mysql +pam -postgres +ssl -static 0 kB
[ebuild   R   ] net-mail/cyrus-imapd-2.2.12-r3  -afs -drac +idled -kerberos +pam -snmp +ssl -tcpd -unsupported_8bit 0 kB
[ebuild   R   ] mail-filter/amavisd-new-2.3.3-r2  -ldap -milter -mysql -postgres 0 kB


And my /var/log/mail.warn gets filled with warnings like this:
Code:

Jan  6 01:10:40 yggdrasill tls_prune[7019]: DBERROR db4: 4 lockers
Jan  6 02:21:04 yggdrasill amavis[6941]: (06941-04) SA TIMED OUT, backtrace: at /usr/lib/perl5/vendor_perl/5.8.6/Mail/SpamAssassin/BayesStore/DBM.pm line 624\n\teval {...} called at /usr/lib/perl5/vendor_perl/5.8.6/Mail/SpamAssassin/BayesStore/DBM.pm line 624\n\tMail::SpamAssassin::BayesStore::DBM::calculate_expire_delta('Mail::SpamAssassin::BayesStore::DBM=HASH(0x9e71f88)', 1136509034, 43200, 512) called at /usr/lib/perl5/vendor_perl/5.8.6/Mail/SpamAssassin/BayesStore.pm line 321\n\tMail::SpamAssassin::BayesStore::expire_old_tokens_trapped('Mail::SpamAssassin::BayesStore::DBM=HASH(0x9e71f88)', 'undef') called at /usr/lib/perl5/vendor_perl/5.8.6/Mail/SpamAssassin/BayesStore.pm line 214\n\teval {...} called at /usr/lib/perl5/vendor_perl/5.8.6/Mail/SpamAssassin/BayesStore.pm line 211\n\tMail::SpamAssassin::BayesStore::expire_old_tokens('Mail::SpamAssassin::BayesStore::DBM=HASH(0x9e71f88)', 'undef') called at /usr/lib/perl5/vendor_perl/5.8.6/Mail/S.


My guess is: "SA TIMED OUT" because the daemon starts more threads than smtp-connections are allowed, and shuts them down after a while. Right?

But what about the other error-messages?
Can someone help me with this?
_________________
--
Linux & such ...
http://blog.hasnoname.de
Back to top
View user's profile Send private message
dashnu
l33t
l33t


Joined: 21 Jul 2004
Posts: 703
Location: Casco Maine

PostPosted: Fri Jan 06, 2006 2:11 pm    Post subject: Reply with quote

Looks like you run a similar setup to mine. However I run mine on a POS SUSE box due to OpenXchange support.

Maybe some of this will help.

In my setup amavis-new daemon runs spamassassin so I have no need to run the spamasassin daemon.
So one you dont need that running or you will loop.

Since amavis runs the daemon I created a .spamassassin directory in the amavis $HOME. This is in the config file.. Mine is /var/spool/amavis not sure if it is the same on gentoo. All of my bayes data and auto_whitelist data is under that dir and owned by the user that runs the amavis daemon.

Also amavis does use some setting from spamassassins local.cf so make sure thigs are set up properly in it.

Code:
# Enable Bayes auto-learning
bayes_auto_learn        1
bayes_path              /var/spool/amavis/.spamassassin/bayes


I can not tell by your error message what is throwing those errors. If it is the spamd daemon you have things setup incorrectly.

If you want to use amavis-new and spamd you need to set up procmail to handle this the correct way. The current way I am using it seems to work great and once you populate your bayes db spam blockage works even better.
_________________
write quit bang
Back to top
View user's profile Send private message
Strowi
l33t
l33t


Joined: 19 Aug 2003
Posts: 656
Location: Bonn

PostPosted: Fri Jan 06, 2006 5:15 pm    Post subject: Reply with quote

hi and thx for the reply.

i forgot to say... everything is working fine, only that error-log is bugging me.
I'm running spamd daemon, because it should be somewhat faster to have a spamassassin already running, otherwise amavis will create a new process for every mail (same goes for clamav). spamd is running as amavis in /var/amavis/.spamassassin and works nicely, except my nightly sa-learn cronjob looks a little bit ugly, since amavis has no shell. So i run
Code:

#!/bin/bash
/usr/bin/sa-learn -u cyrus --spam --dbpath=/var/amavis/.spamassassin/ /var/spool/imap/s/user/strowi/Spam/ >/dev/null 2>&1
/usr/bin/sa-learn -u cyrus --ham --dbpath=/var/amavis/.spamassassin/ /var/spool/imap/s/user/strowi/ >/dev/null 2>&1
chown amavis:amavis /var/amavis/.spamassassin/* >/dev/null 2>&1


Now i tried to reduce the number of sa-daemons and got the last warning-message ~6 hrs ago.;)

again thx for the help!
_________________
--
Linux & such ...
http://blog.hasnoname.de
Back to top
View user's profile Send private message
dashnu
l33t
l33t


Joined: 21 Jul 2004
Posts: 703
Location: Casco Maine

PostPosted: Fri Jan 06, 2006 6:19 pm    Post subject: Reply with quote

Strowi wrote:
hi and thx for the reply.

np
Strowi wrote:

i forgot to say... everything is working fine, only that error-log is bugging me.
I'm running spamd daemon, because it should be somewhat faster to have a spamassassin already running, otherwise amavis will create a new process for every mail (same goes for clamav). spamd is running as amavis in /var/amavis/.spamassassin and works nicely,


You should really take a look at your logs and watch the cycle they go through.. running both spamd and amaivis is unneeded. I could be wrong but I think you are spam scanning twice. do you have a line for spamd in your master.cf ? Either that or you have the daemon running and it is truly not doing anything.
Strowi wrote:

except my nightly sa-learn cronjob looks a little bit ugly, since amavis has no shell. So i run
Code:

#!/bin/bash
/usr/bin/sa-learn -u cyrus --spam --dbpath=/var/amavis/.spamassassin/ /var/spool/imap/s/user/strowi/Spam/ >/dev/null 2>&1
/usr/bin/sa-learn -u cyrus --ham --dbpath=/var/amavis/.spamassassin/ /var/spool/imap/s/user/strowi/ >/dev/null 2>&1
chown amavis:amavis /var/amavis/.spamassassin/* >/dev/null 2>&1

Try this..

Code:

#!/bin/sh
SPAMDIR=confirmed-spam
DIR=/var/spool/imap/$SPAMDIR
C=0
if [ -d $DIR ];then
   cd $DIR && echo now in $DIR
   for I in *.
   do
      if [ -f $I ]; then
         cat $I | su -s /bin/bash - vscan -c "/usr/bin/sa-learn --showdots --spam --single";
         echo $I, $C
         # this removes emails from the shared folder
         rm -v $I
         let C++
      fi
   done

   # as user cyrus reconstruct the maildir files
   su - cyrus -c "reconstruct -r $SPAMDIR"
   echo "processed $C mails"
else
   echo $DIR not found
   exit 1
fi



and this for ham

Code:

#!/bin/sh
SPAMDIR=not-spam
DIR=/var/spool/imap/$SPAMDIR
C=0
if [ -d $DIR ];then
   cd $DIR && echo now in $DIR
   for I in *.
   do
      if [ -f $I ]; then
         cat $I | su -s /bin/bash - vscan -c "/usr/bin/sa-learn --showdots --ham --single";
         echo $I, $C
         # this removes emails from the shared folder
         rm -v $I
         let C++
      fi
   done

   # as user cyrus reconstruct the maildir files
   su - cyrus -c "reconstruct -r $SPAMDIR"
   echo "processed $C mails"
else
   echo $DIR not found
   exit 1
fi


I have set up a shared mail folder for both Spam and Ham for my users to drag messages to.
Strowi wrote:


Now i tried to reduce the number of sa-daemons and got the last warning-message ~6 hrs ago.;)

again thx for the help!


you got it gl
_________________
write quit bang
Back to top
View user's profile Send private message
Strowi
l33t
l33t


Joined: 19 Aug 2003
Posts: 656
Location: Bonn

PostPosted: Fri Jan 06, 2006 6:57 pm    Post subject: Reply with quote

/etc/postfix/main.cf
Code:

...
content_filter = smtp-amavis:[127.0.0.1]:10024
mailbox_transport = cyrus

/etc/postfix/master.cf
Code:

...
smtp-amavis     unix    -       -       y       -       2       smtp
   -o smtp_data_done_timeout=1200
   -o disable_dns_lookups=yes

127.0.0.1:10025 inet    n       -       y       -       -       smtpd
   -o content_filter=
   -o local_recipient_maps=
   -o relay_recipient_maps=
   -o smtpd_restriction_classes=
   -o smtpd_helo_restrictions=
   -o smtpd_sender_restrictions=
   -o smtpd_recipient_restrictions=permit_mynetworks,reject
   -o mynetworks=127.0.0.0/8
   -o strict_rfc821_envelopes=yes


This way incoming mail should go this way, right? incoming -> postfix -> amavisd(clam/spam) -> postfix -> cyrus

If mail gets scanned twice, i think i would get 2*X-Spam-Status Headers.
Spamd doesn't do anything on it's own. But now that i had a closer look (and stopped spamd for testing) i found out that i still get X-Spam-Headers. So i guess spamd really didn't scan anything.

But.. i couldn't find any command starting spamassassin from command-line in /etc/amavis.conf?
_________________
--
Linux & such ...
http://blog.hasnoname.de
Back to top
View user's profile Send private message
dashnu
l33t
l33t


Joined: 21 Jul 2004
Posts: 703
Location: Casco Maine

PostPosted: Fri Jan 06, 2006 7:03 pm    Post subject: Reply with quote

you got it now. Shut off spamd. amavis handles all headers. It also knows the command to use for scanning. It does not invoke the daemon it uses the 'spamassassin' command afaik.

*edit you are correct it was not scanning twice because SA needs a line in the master.cf to function as a daemon.
_________________
write quit bang
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum