Simple Application of SpamAssassin

Source: Internet
Author: User
Tags spamassassin qmail

Here we will only talk about the simple application of SpamAssassin, which is to use the SpamAssassin rule set to mark spam as spam, then, use a policy on the client outlook to automatically transfer emails with spam characters to the spam directory.

See article
CCERT Chinese Spam filtering rule set
Http://www.ccert.edu.cn/spam/sa/Chinese_rules.htm)

Test environment: redhat9.0
Prerequisites: You have installed qmail. The environment set up in this article is qmail + vpopmail + igeus.

1: Install SpamAssassin
Installation Method 1: directly install using CPAN
Perl-MCPAN-e shell
Install Mail: SpamAssassin

2. Compile and install the SDK by yourself.
Download the latest software from http://spamassassin.apache.org

Decompress the package: # perl Makefile. PL
# Make
# Make install

# Perform a spam and non-spam Test
In the spamassassin source file directory:
Spamassassin-t <sample-spam.txt> spamtest.txt
Less spamtest.txt
Spamassassin-t <sample-nonspam.txt> nospamtest.txt
Less nospamtest.txt
The spamtest.txt file contains the line "****** SPAM *****" in the topic section, but does not exist in the nospamtest.txt file.
(Read/etc/mail/spamassassin/local. cf configuration by default .)

If an error is reported during make, refer to this article to Solve the Problem http://blog.5ilinux.com/archives/2005/07/spamassassin.html

3: configure the local. cf file
# Vi/etc/mail/spamassassin/local. cf

# How many hits before a message is considered spam.
Required_hits 9.5

# Text to prepend to subject if rewrite_subject is used
Rewrite_header Subject ****** spam *****

# Encapsulate spam in an attachment
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 1
Use_razor2 0
Use_dcc 0
Use_pyzor 0

# Mail using administration ages used in these country codes will not be marked
# As being possibly spam in a foreign language.
OK _ages all

# Mail using locales used in these country codes will not be marked
# As being possibly spam in a foreign language.
OK _locales all

For details about the SpamAssassin configuration file, refer to SpamAssassin 3.x Configuration Guide (Chinese version)
(Http://anti-spam.org.cn/references/index.php? Action = Show & ID = 9)

4: Download the Chinese rule set for spam
Wget-N-P/usr/share/spamassassin www.ccert.edu.cn/spam/sa/Chinese_rules.cf

5: Combination of qmail and SpamAssassin

Compile qmail-spamc in the spamc directory of SpamAssassin 3.x
# Cc-O-o qmail-spamc qmail-spamc.c
# Install-m 755 qmail-spamc/var/qmail/bin

# Ln-s/var/qmail/bin/qmail-queue/usr/bin/qmail-queue

Edit/etc/tcp. smtp as follows:
127.: allow, RELAYCLIENT = ""
: Allow, QMAILQUEUE = "/var/qmail/bin/qmail-spamc"

Then:
Tcprules tcp. smtp. cdb tcp. smtp. tmp <tcp. smtp

Under the spamd directory of the compilation directory
Mv redhat-rc-script.sh/etc/rc. d/init. d/spamd

Start spamd
/Etc/rc. d/init. d/spamd start

In this way, SpamAssassin will automatically judge spam based on the Rule Set, and mark potential spam emails with the *** spam *** mark at a glance, as for how to set a policy for automatic transfer of spam in outlook on the client, I don't need to talk about it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.