Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
SpamAssassin3 Help
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
mgbowman
n00b
n00b


Joined: 31 Jul 2005
Posts: 47

PostPosted: Sun Jul 31, 2005 9:16 pm    Post subject: SpamAssassin3 Help Reply with quote

I need to setup my server to be an accurate anti-spam machine! I have the basic SpamAssassin up and running but I know it can be extended. I have read tons on the forums about different configurations but I am lost. Could someone help point me in the right direction.

mail-mta/postfix-2.1.5-r2
mail-filter/procmail-3.22-r6
mail-filter/spamassassin-3.0.4

/etc/postfix/main.cf
Code:
...
mailbox_command = /usr/bin/procmail
...


/etc/procmailrc
Code:
MAILDIR=$HOME/.maildir
SPAMDIR=$MAILDIR/.Spam

:0fw
* < 256000
| /usr/bin/spamc -f

:0:
* ^X-Spam-Status: Yes
$SPAMDIR


/etc/mail/spamassassin/local.cf
Code:
required_hits 5.0
report_safe 1


Would a [hourly] cron job as follows work to help SA auto-learn spam and ham
/etc/cron.hourly/sa-learn.cron

Code:
#!/bin/sh

HOME_DIRS="/home/"
MAIL_DIR="/.maildir"
HAM_DIR="$MAIL_DIR/cur"
SPAM_DIR="$MAIL_DIR/.Spam/cur"

for USER in `ls $HOME_DIRS`; do
     sa-learn --ham -f $HOME_DIRS$USER$HAM_DIR
     sa-learn --spam -f $HOME_DIRS$USER$SPAM_DIR
done


Anyone who can give me recommendations on how to better improve my anti-spam measures would be greatly appreciated!
Back to top
View user's profile Send private message
nielchiano
Veteran
Veteran


Joined: 11 Nov 2003
Posts: 1287
Location: 50N 3E

PostPosted: Mon Aug 01, 2005 12:04 am    Post subject: Re: SpamAssassin3 Help Reply with quote

mgbowman wrote:

Would a [hourly] cron job as follows work to help SA auto-learn spam and ham
/etc/cron.hourly/sa-learn.cron

Anyone who can give me recommendations on how to better improve my anti-spam measures would be greatly appreciated!

This would work, but might give odd results...
Since you're just telling SpamAssassin to learn what he alread knew. The thing I do (I can post the script, if you're interested) is to have SA wait for me to confirm that spam is spam and ham is ham before learning it.

Basicaly I have it check (every night) if there are any "read" messages in the spam-dir. all those are confirmed spam. All "read" messages in the inbox are confirmd ham. That way he will learn from his mistakes.
Every day (er every week, depending on how busy I am) I check the spam-dir and use the "mark folder as read" if it's ok.
Back to top
View user's profile Send private message
mgbowman
n00b
n00b


Joined: 31 Jul 2005
Posts: 47

PostPosted: Mon Aug 01, 2005 12:11 am    Post subject: Re: SpamAssassin3 Help Reply with quote

nielchiano wrote:

This would work, but might give odd results...
Since you're just telling SpamAssassin to learn what he alread knew. The thing I do (I can post the script, if you're interested) is to have SA wait for me to confirm that spam is spam and ham is ham before learning it.


But what about the fact this would use the 'cur' dir and not the 'new' dir? If I am off base, I would greatly appreciate you posting your script. Just curious, but do you use any of the network measures? [pyrzor/razor/dcc]
_________________
"Computer programs only do what you tell them to do, not what you want them to do."
Back to top
View user's profile Send private message
nielchiano
Veteran
Veteran


Joined: 11 Nov 2003
Posts: 1287
Location: 50N 3E

PostPosted: Mon Aug 01, 2005 12:44 am    Post subject: Re: SpamAssassin3 Help Reply with quote

mgbowman wrote:
nielchiano wrote:

This would work, but might give odd results...
Since you're just telling SpamAssassin to learn what he alread knew. The thing I do (I can post the script, if you're interested) is to have SA wait for me to confirm that spam is spam and ham is ham before learning it.


But what about the fact this would use the 'cur' dir and not the 'new' dir? If I am off base, I would greatly appreciate you posting your script. Just curious, but do you use any of the network measures? [pyrzor/razor/dcc]

Cur just means that the email-client has already seen it; but not that the USER has seen it.

I haven't got time to fine-tune my SA-setup... also I didn't need to fine-tune it, since it works as it should right now...
here's my script (run nightly)
Code:

# Learn all messages that are seen and NOT flagged
echo -n "Learning ham: "
mails="$(find ~/.maildir/cur/ -daystart -type f -and \
        -name '*S' -and ! -name "*\:2\,*F*")"
if [ ! -z "$mails" ]; then
        sa-learn --ham --no-sync --showdots $mails
        mv $mails ~/.maildir/.old/cur/
        echo "done"
else
        echo "none"
fi

# remove all confirmed (seen) spam
echo -n "Learning spam: "
mails="$(find ~/.maildir/.spam/cur/ -name '*S' -and ! -name "*\:2\,*F*")"
if [ ! -z "$mails" ]; then
        sa-learn --spam --no-sync --showdots $mails
        rm -f $mails
        echo "done"
else
        echo "none"
fi

# rebuild spam-db
echo "Rebuilding spam db..."
sa-learn --sync --showdots
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