SpamAssassin - http://spamassassin.apache.org/
3.1 Download
[root@ihelpers src]# wget http://ftp.apache-kr.org/spamassassin/source/Mail-SpamAssassin-3.1.1.tar.gz
Perl Module Search - http://search.cpan.org/
[root@ihelpers src]# wget http://search.cpan.org/CPAN/authors/id/G/GA/GAAS/Digest-SHA1-2.11.tar.gz
[root@ihelpers src]# tar xvfz Digest-SHA1-2.11.tar.gz
[root@ihelpers Digest-SHA1-2.11]# perl Makefile.PL
[root@ihelpers Digest-SHA1-2.11]# make
[root@ihelpers Digest-SHA1-2.11]# make install
[root@ihelpers src]# wget http://search.cpan.org/CPAN/authors/id/G/GA/GAAS/HTML-Parser-3.51.tar.gz
[root@ihelpers src]# cd HTML-Parser-3.51
[root@ihelpers src]# tar xvfz HTML-Parser-3.51.tar.gz
[root@ihelpers HTML-Parser-3.51]# perl Makefile.PL
Warning: prerequisite HTML::Tagset 3 not found.
Writing Makefile for HTML::Parser
[root@ihelpers src]# wget http://search.cpan.org/CPAN/authors/id/P/PE/PETDANCE/HTML-Tagset-3.10.tar.gz
[root@ihelpers src]# tar xvfz HTML-Tagset-3.10.tar.gz
[root@ihelpers src]# cd HTML-Tagset-3.10
[root@ihelpers HTML-Tagset-3.10]# make
[root@ihelpers HTML-Tagset-3.10]# make install
[root@ihelpers HTML-Parser-3.51]# perl Makefile.PL
Writing Makefile for HTML::Parser
[root@ihelpers HTML-Parser-3.51]# make
[root@ihelpers HTML-Parser-3.51]# make install
3.2 설치
[root@ihelpers src]# tar xvfz Mail-SpamAssassin-3.1.1.tar.gz
[root@ihelpers src]# cd Mail-SpamAssassin-3.1.1
[root@ihelpers Mail-SpamAssassin-3.1.1]# perl Makefile.PL
What email address or URL should be used in the suspected-spam report
text for users who want more information on your filter installation?
(In particular, ISPs should change this to a local Postmaster contact)
default text: [the administrator of that system]
NOTE: settings for "make test" are now controlled using "t/config.dist".
See that file if you wish to customise what tests are run, and how.
checking module dependencies and their versions...
***************************************************************************
NOTE: the optional Razor2 (version 2.61) module is not installed.
Used to check message signatures against Vipul's Razor collaborative
filtering network. Razor has a large number of dependencies on CPAN
modules. Feel free to skip installing it, if this makes you nervous;
SpamAssassin will still work well without it.
More info on installing and using Razor can be found
at http://wiki.apache.org/spamassassin/InstallingRazor
Net::Ident::_export_hooks() called too early to check prototype at /usr/lib/perl5/site_perl/5.8.0/Net/Ident.pm line 29.
optional module missing: Razor2
warning: some functionality may not be available,
please read the above report before continuing!
Writing Makefile for Mail::SpamAssassin
Makefile written by ExtUtils::MakeMaker 6.03
[root@ihelpers Mail-SpamAssassin-3.1.1]# make
[root@ihelpers Mail-SpamAssassin-3.1.1]# make test
[root@ihelpers Mail-SpamAssassin-3.1.1]# make install
3.3 Test
[root@ihelpers Mail-SpamAssassin-3.1.1]# spamassassin -t < sample-nonspam.txt
[root@ihelpers Mail-SpamAssassin-3.1.1]# spamassassin -t < sample-spam.txt
나. SpamAssassin Daemon ( 'spamd' Daemon ) 실행 - sendmail
3.4 사용자 추가
groupadd spamd
useradd -g spamd spamd
3.5 스크립트 및 서비스 등록
vi /etc/sysconfig/spamassassin
# Hint : if you want to enable SpamAssassin debugging
# (the debug output goes to /var/log/maillog) then use :
# SPAMDOPTIONS="-x -u spamd -H /home/spamd -d -D"
# Don't leave debugging turned on unnecessarily though,
# because it will slow down a busy server.
#
# Otherwise, for normal operation (debugging disabled) use :
SPAMDOPTIONS="-x -u spamd -H /home/spamd -d"
[root@ihelpers init.d]# cp redhat-rc-script.sh /etc/rc.d/init.d/spamd
[root@ihelpers init.d]# chkconfig --add spamd
[root@ihelpers init.d]# vi /etc/mail/spamassassin/local.cf
[root@ihelpers init.d]# /etc/rc.d/init.d/spamd start
procmail은 수신메일을 spamc에 전달하고 spamc는 데몬에 연결하여 이메일을 확인하도록 한다. spamd 데몬은 항상 실행상태에 있으며 전달받은 메일을 스캔해 스팸인 경우 별도의 스팸표시를 한다.
3.6 procmailrc 설정
[root@ihelpers root]# cat /etc/procmailrc #
# SpamAssassin procmail
#
OPPRIVS=yes
:0fw
* < 256000
| /usr/bin/spamc
3.7. 환경설정
1. spamassassin 설정파일 추가 및 수정
[root@ihelpers root]# cat /etc/mail/spamassassin/local.cf
# This is the right place to customize your installation of SpamAssassin.
#
# See 'perldoc Mail::SpamAssassin::Conf' for details of what can be
# tweaked.
#
# Only a small subset of options are listed below
#
###########################################################################
# Add *****SPAM***** to the Subject header of spam e-mails
#
rewrite_header Subject *****SPAM*****
# Save spam messages as a message/rfc822 MIME attachment instead of
# modifying the original message (0: off, 2: use text/plain instead)
#
report_safe 0
# Language
#
ok_locales en ko
ok_languages en ko
# Set which networks or hosts are considered 'trusted' by your mail
# server (i.e. not spammers)
#
# trusted_networks 212.17.35.
# Set file-locking method (flock is not safe over NFS, but is faster)
#
lock_method flock
# Set the threshold at which a message is considered spam (default: 5.0)
#
required_score 8.0
# Use Bayesian classifier (default: 1)
#
use_bayes 1
# Bayesian classifier auto-learning (default: 1)
#
bayes_auto_learn 1
# Set headers which may provide inappropriate cues to the Bayesian
# classifier
#
bayes_ignore_header X-Bogosity
bayes_ignore_header X-Spam-Flag
bayes_ignore_header X-Spam-Status
# Rules for all senders
score HEADER_8BITS 0
score HTML_COMMENT_8BITS 0
score SUBJ_FULL_OF_8BITS 0
3.8 데몬 재 실행
[root@ihelpers root]# /etc/rc.d/init.d/spamd restart
Shutting down spamd: [ 확인 ]
Starting spamd: [ 확인 ]
3. SpamAssassin Configuration Tool
http://www.yrex.com/spam/spamconfig.php