OSXのspamメール対策にはspamassassin があって、マニュアルによれば自動的に学習するが、学習したメールを廃棄しない となっている。やってられないので Spamtrainer を導入した。
解凍して、素直にインストールした。
spammail notspammail のアカウントははマニュアル通りに作ってあったから、
まず、Spamtrainer のマニュアルにしたがって、root 権限で、spamtrainer -fを実行。
root# /usr/sbin/spamtrainer -f
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 10.4.7 or 10.4.8, 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 created
The existing directory /var/amavisd/.spamassassin has been
backed up to /var/amavis/.spamassassin_04132007-130258
The existing file /etc/amavisd.conf has been
backed up to /etc/amavisd.conf_back_04132007-130258
@local_domains_maps = ( 1 ); was added to amavisd.conf
This ensures that additional domains will get processed
by the content filter as well.
The existing file /etc/local.cf has been
backed up to /private/etc/mail/spamassassin/local.cf_back_04132007-130300
local.cf was fixed
This ensures the settings are correct for your system.
Starting amavisd…
If you use 10.4.7 or 10.4.8, this may produce:
‘Workaround Bonjour: Unknown error: 0’.
It is safe to ignore it.
root#Workaround Bonjour: Unknown error: 0
次に、読み込むメールと実施する時間を設定するため
/usr/sbin/spamtrainer -i を実行
root# /usr/sbin/spamtrainer -i
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
If you want to use ‘spamtrainer’ it IS RECOMMENDED that this cron be disabled
Would you like me to disable it for you (yes/no)
yes
‘learn_junk_mail’ cron job has been disabled’
There IS NO plist for spamtrainer
There IS NO cron job for 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#
これで junkmail, notjunkmail を毎日午前1時に読み込み、消去するはず...