[Mimedefang] learning database
Stephen J. Smoogen
smooge at gmail.com
Sat Oct 15 10:40:50 EDT 2005
On 10/15/05, Matevz <matevz at sloweb.net> wrote:
> Hi,
>
> I am pretty new to mimedefang, so i have a question regarding to learning.
> When I use sa-learn command as root it stores data in /root/.spamassassin/ ?
>
> So I add these lines to sa-mimedefang.cf
>
> use_bayes 1
> use_bayes_rules 1
> bayes_path /root/.spamassassin/
> bayes_auto_learn 1
> bayes_learn_to_journal 1
> bayes_auto_expire 0
> Is this OK?
>
You need to have the database in a way that mimedefang can read and write.
I am running Fedora Core 3 with mimedefang and spamassassin.
mimedefang runs as the user defang and uses /etc/mail/spamassassin for
its database area. How I set things up is the following:
gather 100+ yam and 100+ spam messages for the broth.
cp ham spam /tmp
chmod 0444 /tmp/yam /tmp/spam
su - root
chown defang.defang /etc/mail/spamassassin
chmod 0755 /etc/mail/spamassassin
su -s /bin/bash - defang
sa-learn --ham --mbox --dbpath /etc/mail/spamassassin/ /tmp/yam
sa-learn --spam --mbox --dbpath /etc/mail/spamassassin/ /tmp/spam
exit
rm /tmp/yam /tmp/spam
exit
Thats about it. I am a small site with 4 email addresses so this works
well. I have heard that for larger sites you will want to extend this
with individual spamassassin databases as one mans spam is another
mans yam.
> Because I think spamassassin does not use this database, how can i test
> this if it works?
Well you should also make sure the lines in
/etc/mail/mimedefang-filter are turned on:
if ($Features{"SpamAssassin"}) {
spam_assassin_init()->compile_now(1) if defined(spam_assassin_init());
if (defined($SASpamTester)) {
use Mail::SpamAssassin::DBBasedAddrList;
my $awl = Mail::SpamAssassin::DBBasedAddrList->new();
$SASpamTester->set_persistent_address_list_factory($awl) if
defined($awl);
}
}
and
sub filter_end ($) {
my($entity) = @_;
return if message_rejected();
if ($Features{"SpamAssassin"}) {
if (-s "./INPUTMSG" < 100*1024) {
my($hits, $req, $names, $report) = spam_assassin_check();
my($score);
if ($hits < 40) {
$score = "*" x int($hits);
} else {
$score = "*" x 40;
}
if ($hits >= $req) {
action_change_header("X-Spam-Score", "$hits ($score) $names");
md_graphdefang_log('spam', $hits, $RelayAddr);
} else {
}
}
}
md_graphdefang_log('mail_in');
}
If these are turned on you should see "X-Spam-Score" being added to
your messages.
--
Stephen J Smoogen.
CSIRT/Linux System Administrator
More information about the MIMEDefang
mailing list