spamassasin

2月初旬からどんどんspam mail の識別率がわるくなってきた。

そこで、threshold を3に下げてみた。

さらに /etc/mail/spamassassin/local.cf に

whitelist_from #@mike.md.tsukuba.ac.jp *@kiban.md.tsukuba.ac.jp

を書き加えた。つまりmike とkibenからのメールは無条件にspam と判定しないということだ。

Spamtrainer のバージョンが1.8.5 に上がっていたのでアップデートした。でもって;

ここを参考に (2007/4/21 土曜日の記事)

root# /usr/sbin/spamtrainer -f

+——————————————————————–+
| |
| spamtrainer |
| |
| Version 1.8.5 |
| |
| Copyright (c) 2005 – 2007 |
| Athanasios Alexandrides <tools@topicdesk.com> |
| |
+——————————————————————–+

If necessary, this will create the missing symbolic link in OS X 10.4.x.
It will also fix other configuration issues in the default installation,
which prevent spamassassin from properly working with additional domains.
All files modified by this routine will be first backed up in their
respective directories
Read the ‘Caveats’ chapter in the included documentation for more information.

Would you like to proceed? (yes/no)
yes
Stopping amavisd…
If you use Tiger Server 10.4.7 or higher, this may produce:
‘Workaround Bonjour: Unknown error: 0’.
It is safe to ignore it.

The symbolic link from
/var/amavisd/.spamassassin to /var/clamav/.spamassassin
has been verified and/or fixed

amavisd.conf needed no changes.

local.cf needed no changes.

Starting amavisd…
If you use Tiger Server 10.4.7 or higher, this may produce:
‘Workaround Bonjour: Unknown error: 0’.
It is safe to ignore it.
root# Workaround Bonjour: Unknown error: 0

というわけで、アップデートだから問題なく終了。で次に;

root# /usr/sbin/spamtrainer -i

+——————————————————————–+
| |
| spamtrainer |
| |
| Version 1.8.5 |
| |
| Copyright (c) 2005 – 2007 |
| Athanasios Alexandrides <tools@topicdesk.com> |
| |
+——————————————————————–+

Checking if there is a startup item for ‘learn_junk_mail’ or ‘spamtrainer’

There IS NO plist for learn_junk_mail

There IS a cron job for learn_junk_mail, but it is DISABLED
(cronのjunkmail学習が動いていないぞ だって)

Would you like me to re-enable it for you and remove ‘spamtrainer’ (yes/no)
You will lose ‘spamtrainer’ functionality
yes
‘learn_junk_mail’ cron job has been enabled’
‘spamtrainer’ cron job has been removed’
You can re-enable it by running ‘spamtrainer -i’

There IS NO plist for spamtrainer

There IS NO cron job for spamtrainer
(cron にspamtrainer が登録されてないぞ だって)
if you want to use ‘spamtrainer’ it is recommended that this be added
Would you like me to enable it for you (yes/no)
yes
What time would you like the job to run (24-hour format)?
Please enter the hour (1)
1
Please enter the minutes (0)
0
Would you like SPAM/HAM messages to be deleted after the learn process? (n)
y
Would you like to log bayes stats into /var/log/spamtrainer.log? (n)
y
Enter name of mail store with SPAM/HAM mailboxes? Enter for default (default)
default
Enter name of mailbox with SPAM? Enter for default (junkmail)
junkmail
Enter name of mailbox with HAM? Enter for default (notjunkmail)
notjunkmail
The following cron job for ‘spamtrainer’ has been prepared
0 1 * * * /usr/sbin/spamtrainer -p default -j junkmail -n notjunkmail -d -l
Would you like to add it? (yes/no)
yes
The following cron job for ‘spamtrainer’ has been enabled’
0 1 * * * /usr/sbin/spamtrainer -p default -j junkmail -n notjunkmail -d -l
root#

でおしまい。 ちなみにspamtrainer のマニュアルは;

# man spamtrainer

spamtrainer(1)            BSD General Commands Manual           spamtrainer(1)

NAME
spamtrainer — automated training of SpamAssassin database.

SYNOPSIS
spamtrainer [-pdljnsabchifrv] [path] [partition_name] [file_name]
[options]

DESCRIPTION
spamtrainer helps Mail Administrators in updating and maintaining their
SpamAssassin database.

When run, it will read the designated HAM and SPAM mailboxes, update the
SpamAssassin databases and delete mail that has been learned from.

It will also check for updates. It is recommended that available updates
be installed.

The options are as follows:

-p [path]
Specify a mail partition or store other than default

-d       Delete read/learned mailboxes

-x [number_of_days]
Specify how old mail must be to be deleted

-l       Log bayes stats into /var/log/spamtrainer.log

-j [name]
Specify the name of the mailbox containing junk

-n [name]
Specify the name of the mailbox containing good mail

-t       Use top level / shared folder instead of user folder

-b filename
Backup spamassassin bayes database to file

-r filename
Restore spamassassin bayes database from file

-s [path]
Specify the path to the sa-learn program

-c       Clean/purge the SpamAssassin database

-h       Display help

-i       Check and install a cron job for this script.

-f       Fix the amavisd/spamassassin configuration on OS X 10.4.x

-a       Add rulesets on OS X 10.5.x and OS X 10.4.x

-v       Display version information.

Alternatively you can create a cron job that will run spamtrainer auto-
matically at a given time.

EXAMPLES
— Install startup item:

spamtrainer -i

— Train with default values:

spamtrainer

— Train with given partition NAME:

spamtrainer -p mymailpartition

— Train with given partition NAME and delete processed mail:

spamtrainer -p mymailpartition -d
— Train with given partition NAME, mailbox names and delete:

spamtrainer -p mymailpartition -j myjunkmailbox -n mynotjunkmailbox -d

FILES
/usr/sbin/spamtrainer

DIAGNOSTICS
The spamtrainer utility exits 0 on success, and >0 if an error occurs.

SEE ALSO
crontab(1), crontab(5)

AUTHORS
Athanasios Alexandrides <tools@topicdesk.com>

Mac OSX                        October 26, 2007                        Mac OSX
(END)
といたってsimpleなのだ。