APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

Installing Spamassassin by Amarjyoti Krishnan

© December 2005 Amarjyoti Krishnan

Lets get to the topic straight away.... spam. Spammers can help increase the size of certain body parts that will make you the most desirable person in this world. And if you are fat, they have the pills for you. They have machines that will do the job without any effort on your part. Machines that will round out your flat butt or flatten out your round butt while you sleep. Spammers help you grow hair on your head and remove it from other body parts. You can picture yourself with a slim waist, rounded buttocks, hairless legs and with essential body parts which have now increased in size.

It does not stop here, if you don't have credit card debt, they will give you a credit card with pre-approved unlimited limits. They get you any number of degrees and diplomas. That's not all, the spammers in Nigeria trust you more than they trust anybody else in this world.... :-D

Spam is one of the biggest problems of the internet and just about everybody has written about it: Bill Gates. I did not want to be one of those guys who blogs and never wrote about spam, one of the most loved subjects of bloggers.

I was getting about 400 spam messages a day. If I was away from the computer for a day I would come the next day with about 800 messages in my inbox. This was really taking away a lot of my time and I was even losing important mails by accidentally deleting it in the process of deleting spam. Let's start with the definition of spam.

The word "Spam" as applied to email means Unsolicited Bulk Email ("UBE") or Unsolicited Commercial Email ("UCE").

Unsolicited means that the Recipient has not granted verifiable permission for the message to be sent. Bulk means that the message is sent as part of a larger collection of messages, all having substantively identical content.

A message is Spam only if it is both Unsolicited and Bulk.

SPAM on the other hand is Spiced Pork and hAM. According to the The SPAM Home Page, the ingredients of SPAM are as follows:

SPAM was trademarked in 1937 as this meat product. Here is the link to their page about their product and spam. https://www.spam.com/games/facts/default.aspx So we never refer to junk mail as SPAM even if we are angry. We just call it spam in small letters.

Spam is also the name of a popular skit by the British comedy troupe Monty Python. In the bit, a group of Vikings dining in a restaurant sing "Spam, spam, spam" repeatedly, annoying the other patrons and making conversation difficult. Apparently, when junk email started to make its bothersome presence felt, the majority of it was posted to newsgroups. "This large amount of unwanted crap made normal discussion impossible which reminded people of the Monty Python skit about SPAM. Thus everyone started calling these junk newsgroup mailings as spam."

Here are some methods to avoid spam

  1. Be careful what you sign up for online.  Do not give your email address to everybody.
  2. Do not go a subscribe for newsletters at unknown sites. Even popular sites sometimes sell the email addresses so be careful. If possible take a free account from hotmail or yahoo for subscribing. Yahoo and hotmail has good spam filters to avoid spam
  3. When posting in guest books or newsgroups, write your email address in an human readable format. e.g. write user at domain dot come instead of user@domain.com . This is one very good way to reduce spam.
  4. Consider subscribing to a spam prevention service (Black List)s
  5. Use email filters in your mail client
  6. When you forward e-mails, be careful. Continuous forwards can result in anyone being able to harvest several e-mail addresses from just one of these bulky e-mails! Use bcc when sending a mail to many recipients.
  7. Never click on the "Remove" link found in many spam e-mails. This only enables the company or individual sending the spam to verify that their e-mail reached someone.

If you have a server of yours, then instead of using a spam prevention service, it is a good idea to install a spam blocking software on the server like spamassassin. This is one great software. We use qmail as the mail server on our servers. My first idea was to install spamassassin , qmail scanner, razor and clam antivirus for the entire server. But then I realized the load was quite high. Though I still feel it is a good idea to do so. However at present I have just installed spamassassin with razor on the server. Now we can install spamassassin on the accounts we want. So if you do not like your mail being filtered you still can.

SpamAssassin (from the site) - SpamAssassin(tm) is an extensible email filter which is used to identify spam. Using its rule base, it uses a wide range of advanced heuristic and statistical analysis tests on mail headers and body text to identify "spam", also known as unsolicited bulk email.

Razor (from the site) - Vipul's Razor is a distributed, collaborative, spam detection and filtering network. Through user contribution, Razor establishes a distributed and constantly updating catalogue of spam in propagation that is consulted by email clients to filter out known spam. Detection is done with statistical and randomized signatures that efficiently spot mutating spam content. User input is validated through reputation assignments based on consensus on report and revoke assertions which in turn is used for computing confidence values associated with individual signatures.

i.e. razor and spamassassin together can help you fight spam. The installation process is quite simple. We have qmail and perl already installed on our server. We use vmailmgr for managing the accounts. Spamassassin is perl modules. So I used cpan to install it. It was a very simple process. Given below are steps for installing spamassassin and razor.

First install spamassassin -

# cpan
cpan> install  Mail::SpamAssassin

Download Razor from the site https://razor.sourceforge.net/ .

# wget https://easynews.dl.sourceforge.net/sourceforge/razor/razor-agents-2.61.tar.gz
# gzip -dc razor-agents-2.61.tar.gz | tar -xvf-
# cd razor-agents-2.61
# perl Makefile.PL
# make
# make test
# make install

Update your spamassassin user_prefs file to -

# SpamAssassin user preferences file.  See 'perldoc Mail::SpamAssassin::Conf'
# for details of what can be tweaked.

# How many hits before a mail is considered spam.
 required_hits  2.9

# Whitelist and blacklist addresses are now file-glob-style patterns, so
# "friend@somewhere.com", "*@isp.com", or "*.domain.net" will all work.
# whitelist_from        someone@somewhere.com
whitelist_from info@thmedia.net

#by amar
ok_locales en
ok_languages en

# Add your own customised scores for some tests below.  The default scores are
# read from the installed spamassassin rules files, but you can override them
# here.  To see the list of tests and their default scores, go to
# https://spamassassin.org/tests.html .

# Speakers of Asian languages, like Chinese, Japanese and Korean, will almost
# definitely want to uncomment the following lines.  They will switch off some
# rules that detect 8-bit characters, which commonly trigger on mails using CJK
# character sets, or that assume a western-style charset is in use.
# score HTML_COMMENT_8BITS      0
# score UPPERCASE_25_50         0
# score UPPERCASE_50_75         0
# score UPPERCASE_75_100        0

The required hits value can be changed to whatever value you feel is good for your system. For us 2.9 works best. At 2 you may loose genuine mails and 3 you may get some spam. The locales to english and giving high scrores to Microsoft executables really helps remove spammers from other countries and those who send microsoft virus.

Now set spamassassin for the users. Here is a sample .qmail-foward file. Create a .qmail-user

| preline /usr/bin/procmail -m /home/poornam/.procmailrc-user

Now the all we need to do is create the procmail file.

Create the .procmailrc-user file to look like -

:0fw: spamassassin.lock
| /usr/bin/spamassassin
* ^X-Spam-Status: Yes

That's it, this is all I did to get rid of all that spam. Now my mailbox is free of spam and I do not miss the emails telling me the secrets of earning $50000 overnight when I am loosing weight as well as increasing it by 4 inches....

Author Bio

Amarjyoti Krishnan heads https://Bobcares.com, Tech support company for webhosts and ISPs. He is the co-founder of Poornam Info Vision Ltd., a software and IT services company which specializes in Linux based solutions for Webhosts and ISPs. Poornam Info Vision is an ISO 9001:2000 certified company with a team of over 100 engineers.

Amarjyoti is a Computer Engineer based in India and has over 7 years of experience in the hosting industry. He has spoken and written extensively on the subject. His articles have been published both online as well as in print in magazines.

Got something to add? Send me email.

(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> Installing Spamassassin

Inexpensive and informative Apple related e-books:

Digital Sharing Crash Course

Take Control of High Sierra

Take Control of IOS 11

Take Control of Automating Your Mac

Take control of Apple TV, Second Edition

More Articles by © Amarjyoti Krishnan

Printer Friendly Version

Have you tried Searching this site?

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us

Printer Friendly Version

C++: NSStringWithoutYourMothersHatButWithNiceCandyFrosting - aargh! (Tony Lawrence)

Linux posts

Troubleshooting posts

This post tagged:



Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode