Welcome!

Linux Authors: Michael Sheehan, Lavenya Dilip, Ian Thain, Bruce Armstrong, Ellen Rubin

Related Topics: Linux

Linux: Article

How to reduce spam for your users & everyone else

Cut spam from inboxes everywhere with Vipul's Razor, a distributed spam cooker

(LinuxWorld) -- We all get spam. It is a fact. It is like unsolicited postal mail. The only way to way to avoid spam is to not have an e-mail account. Phone solicitation has gotten better, as some local telephone companies will put a pre-screen on your calls for $1 per month. I pay for this service, and have not received a telephone solicitation in more than a year.

However, what can we do about spam e-mail? If you are technically savvy, you can create a bunch of procmail filters, or if you understand your e-mail client you can use client-side filtering. That does not help Grandma, who only knows how to use the send/receive button. It also does not help me, as my wife keeps forwarding me all the pornographic e-mail she receives. She seems to believe that if she bothers me enough about it I will magically make it go way.

Solving it magically is probably out of the question. There is not one ounce of Gandalf blood in this boy's body, but technologically there may be an opportunity. From Vipul Ved Prakash comes Vipul's Razor.

Vipul's Razor is an open source (see resources) project hosted by SourceForge. Razor is a "distributed and constantly updating catalog of spam in propagation." Think of it as a real-time Dewey Decimal System of spam, but it does more than just index spam. It tracks, identifies, and harasses spam, and when it finds spam, it destroys it.

Unlike many open source projects, the installation of Razor was not in any way circuitous. Vipul Ved Prakash even had the audacity to include a well-packaged tarball of required Perl modules along with a global makefile. What is this guy thinking? Does he not know that all of us open source people enjoy being placed on the medieval rack when we install software?

The following is a list of steps for installing the Razor filter:

  1. Point Web browser to razor.sourceforge.net
  2. Download razor-agents-sdk
  3. Download razor-agents
  4. Unpack
  5. Make razor-agents-sdk
  6. Make test razor-agents-sdk
  7. Make install razor-agents-sdk
  8. Repeat with razor-agents
  9. Read man pages razor-check, razor-report and razor-discover

It is easy to master the configuration of the Razor through a generous helping of man page content. Razor is designed to be operated through procmail. Procmail, which is installed by default on most Linux distributions, makes the journey to a utopia of spam-free e-mail even closer. For example, if you want to pre-check all e-mail on your server before it is sent to the intended recipient, you place the following in your .procmailrc (or /etc/procmailrc, depending on the configuration of your server).

:0 Wc
| razor-check
:0 Waf
| formail -i "Subject: Razor Warning: SPAM/UBE/UCE"

The above example will check all e-mail, and if it finds an e-mail that is designated as spam from the distributed Razor catalog, it will rename the subject of the e-mail to:

Razor Warning: SPAM/UBE/UCE

Alternatively, you can have all identified e-mail sent to a file for later review. Why would I want to review my spam, one may ask. Well, technology is not perfect, and neither is the Internet. There is a chance that something may be mislabeled as spam, and you would not want to lose an ultra-important e-mail just because of a mistake in Razor's catalog. To drop spam into a file, you can use the following procmail recipe:

:0 Wc
| razor-check
:0 Wa
/home/foo/mail/razor-caught

All you have to do is change the last line of /home/foot/mail/razor-caught to the path of the file that you would like to actually save the spam in. Beyond the man pages, the documentation gets a little light on the butter. It does not tell you, for example, if you have to run razor-discover more than once, and it makes mention of a razord file that does not appear to exist. However, at this point I am collecting spam using a simple configuration of running razor-discover and the razor-check on all incoming mail.

I let Razor run over the weekend before I turned in this story to see how well razor cut my spam. (You knew that pun was coming, didn't you?) Since the 21st of December (I write this on the 24th) it has caught more than 40 pieces of spam in my main inbox. Razor slashed more than half of the spam I received. Not bad.

The last thing I did with razor was set up a centralized mailbox on our mail server. Razor calls this a trollbox. In short, we have a mailbox on the server with the address of spam. If I receive spam in my main mail inbox that Razor does not catch, I just forward it to spam. The spam mailbox has a filter that uses razor-report on every e-mail it receives. The use of razor-report ensures that I don't receive the same e-mail again. Since razor is a distributed tool, my use of razor-report ensures that everyone using Razor does not receive the e-mail.

If you are tired of all of those e-mails that say, "Free Credit Card," "Mortgage Rates Dropped Again," or "Hot Young Teens," Razor is a quick and effective way to reduce your spam traffic. Although Razor does not catch all spam, it is a sure-fire way to reduce the amount of the virtual pink meat you receive, for both yourself and other Razor users.

More Stories By Joshua Drake

Joshua Drake is the co-founder of Command Prompt, Inc., a PostgreSQL and Linux custom development company. He is also the current author of the Linux Networking HOWTO, Linux PPP HOWTO, and Linux Consultants HOWTO. His most demanding project at this time is a new PostgreSQL book for O'Reilly, 'Practical PostgreSQL'

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.