===== Spam Assassin =====
==== Spam Assassinのインストール ====
$ sudo apt-get install spam assassin spamc
$ sudo groupadd spamd
$ sudo useradd -g spamd -s /bin/false -d /var/log/spamassassin spamd
$ sudo mkdir /var/log/spamassassin
$ sudo chown spamd:spamd /var/log/spamassassin
$ sudo vi /etc/default/spamassassin
ENABLED=1
CRON=1
SAHOME="/var/log/spamassassin/"
OPTIONS="--create-prefs --max-children 2 --username spamd \
-H ${SAHOME} -s ${SAHOME}spamd.log"
==== Postfixの設定 ====
$ sudo vi /etc/postfix/master.cf
$ sudo service postfix restart
smtp inet n - - - - smtpd -o content_filter=spamassassin
spamassassin unix - n n - - pipe
user=spamd argv=/usr/bin/spamc -f -e
/usr/sbin/sendmail -oi -f ${sender} ${recipient}
==== Spam Assassinの設定 ====
$ sudo vi /etc/spamassassin/local.cf
rewrite_header Subject [***** SPAM _SCORE_ *****]
required_score 3.0
use_bayes 1
bayes_auto_learn 1
$ sudo service spamassassin restart
==== Spam Assassinのテスト ====
% telnet current_setting_mail_server 25
Trying 192.168.XX.X...
Connected to 192.168.XX.X.
Escape character is '^]'.
220 xxx ESMTP Postfix (Ubuntu)
HELO xxx
250 xxx
MAIL FROM: hoge@foo.bar
250 2.1.0 Ok
RCPT TO: correct_address@current_setting_mail_server
250 2.1.5 Ok
DATA
354 End data with .
This is a test.
.
250 2.0.0 Ok: queued as 965A6B40A3F
QUIT
221 2.0.0 Bye
Connection closed by foreign host.
>