登录 |  注册 |  繁體中文


postfix 和 SpamAssassin 的结合

分类: 服务器相关 颜色:橙色 默认  字号: 阅读(906) | 评论(0)

INSTALL SPAMASSASSIN

Install the SpamAssassin package using yum by running:

## yum install spamassassin

SET-UP USER

create spamfilter group used for the user that will run the spamassassin service

## groupadd spamfilter

create new user spamfilter with a home directory of /usr/local/spamassassin and add it to the spamfilter group you just created

## useradd -g spamfilter -s /bin/false -d /usr/local/spamassassin spamfilter
## chown spamfilter: /usr/local/spamassassin

CONFIGURE SPAMASSASSIN

next, configure spamassassin by editing /etc/mail/spamassassin/local.cf and adding/setting the following

## vim /etc/mail/spamassassin/local.cf

## Required_hits: This determines the filter balance; the lower the score the more aggressive the filter.
# A setting of 5.0 is generally effective for a small organisation or a single user.
# Adjust the strictness score to your organizations needs - a large medical organisation might want  to let email items
# through that are trying to sell pharmaceuticals, so we might increase the level to a more modest 8.0.
required_hits 5
## Report_safe:  This line determines whether to delete the item or to move the item to the inbox whilst appending
# a spam notice to the subject line. The levels for this line are set to either a 1 or 0. A score of 1 will delete the spam item,
# whereas a score of 0 will send the item to the inbox and rewrite the subject line.
report_safe 0
rewrite_header Subject [**SPAM**]
## Required_score: This line sets the spam score for all email allowed through to your domain, with levels of certainty set from 0 to 5.
# Zero would be classified as a legitimate email item, whereas 5 would be an definite SPAM item.  If we set the score to 3 we would catch a
# lot of unsolicited emails but quite a few false positives would still get through. For our example email server we will use the score of 5,
# but you can of course set this value according to your preference.
required_score 5.0

before we proceed with starting-up the spamassassin service, we need to make sure it runs with our newly created spamfilter user by editing /etc/sysconfig/spamassassin and setting-up the following:

## vim /etc/sysconfig/spamassassin

# Options to spamd
SAHOME="/usr/local/spamassassin"
SPID_DIR="/var/run/spamassassin"
SUSER="spamfilter"
SPAMDOPTIONS="-d -c -m5 --username ${SUSER} -H ${SAHOME} -s ${SAHOME}/spamfilter.log"

with all that in place, we are ready to start and enable the spamassassin service on system startup using:

## service spamassassin start
## chkconfig spamassassin on

CONFIGURE POSTFIX

next thing you need to do is to actually integrate spamassassin into postfix so it can scan and mark the emails that were detected as SPAM. To achieve this we need to edit postfix configuration file. Edit master.cf:

## vim /etc/postfix/master.cf

and add/edit the following lines:

smtp      inet  n       -       n       -       -       smtpd -o content_filter=spamassassin
spamassassin unix -     n       n       -       -       pipe user=spamfilter argv=/usr/bin/spamc -f -e  /usr/sbin/sendmail -oi -f ${sender} ${recipient}

then, restart postfix for the changes to take effect

## service postfix restart



上一篇:Composer使用   下一篇:postfix 配置 DKIM签名

姓 名: *
邮 箱:
内 容: *
验证码: 点击刷新 *   

回到顶部