블로그 이미지
Rootrator
1개를 알면 모르는 10개가 튀어나온다..!

calendar

1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31

Notice

2012. 2. 3. 14:13 Linux

sendmail과 spamassassin을 이용하여 스팸메일을 걸러내도록 해보자.

yum을 이용하여 spamassassin 설치

 설치확인
[root@mail mail]# rpm -qa spamassassin
spamassassin-3.3.1-2.el6.i686

서비스를 올릴 계정으로 spmad 생성
[root@mail mail]# useradd -s /bin/false spamd
[root@mail mail]# cat /etc/passwd | grep spam
spamd:x:886:887::/home/spamd:/bin/false

아래내용을 복사해서 해당 파일에 넣어주자
[root@mail mail]# 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@mail mail]# vi /etc/mail/spamassassin/local.cf
#SpamAssassin config file for version 3.x
# NOTE: NOT COMPATIBLE WITH VERSIONS 2.5 or 2.6
# See http://www.yrex.com/spam/spamconfig25.php for earlier versions
# Generated by http://www.yrex.com/spam/spamconfig.php (version 1.50)
# How many hits before a message is considered spam.
required_score           7.5
# Change the subject of suspected spam
rewrite_header subject         [SPAM]
# Encapsulate spam in an attachment (0=no, 1=yes, 2=safe)
report_safe             1
# Enable the Bayes system
use_bayes               1
# Enable Bayes auto-learning
bayes_auto_learn              1
# Enable or disable network checks
skip_rbl_checks         0
use_razor2              0
use_dcc                 0
use_pyzor               1
# Mail using languages used in these country codes will not be marked
# as being possibly spam in a foreign language.
ok_languages            all
# Mail using locales used in these country codes will not be marked
# as being possibly spam in a foreign language.

ok_locales              all

*required_score가 낮을수록 더 엄격하게 필터링이 된다.

*도메인을 화이트 리스트를 추가하려면 whitelist_from *@abc.com 로 추가해 준다.

[root@mail mail]# vi /etc/procmailrc
DROPPRIVS=yes

#SpamAssassin Procmail start

#

:0fw: spamassassin.lock

* < 256000

| spamc -u $LOGNAME
#SpamAssassin End
 


이제 서비스를 올려보자.

[root@mail mail]# service sendmail restart
[root@mail mail]# service spamassassin start

[root@mail mail]# ps -aux | grep spam
root     30221  0.3  6.9  45244 35348 ?        Ss   13:40   0:05 /usr/bin/spamd -x -u spamd -H /home/spamd -d -r /var/run/spamd.pid
spamd    30222  1.4  8.0  50836 41424 ?        S    13:40   0:25 spamd child
spamd    30224  0.0  7.5  48120 38396 ?        S    13:40   0:01 spamd child



 


반응형
posted by Rootrator