PDA

View Full Version : Throwing SPAM Away Before It Reaches You



jim
10-11-2003, 01:15 PM
I get about 400-500 SPAM messages a day which I've been downloading and immediately filtering into the trash. To say nothing of the webspace they were wasting. Using Progmail these have dropped almost to zero.

In this message I attempt to give a cookbook explanation for how to use Procmail to throw away mail identified as SPAM by SpamAssassin before it enters your life.

There have been messages on this group about using Procmail to throw away SPAM, but usually they were in the form of people posting Procmail scripts they couldn’t make work. Getting some advice. Then saying, “Thanks, that was the problem,” and never posting a corrected/working script. Also, no one has explained how to do the entire procedure. I worked my way through it this morning and this is an attempt at complete procedure for doing it.

First, using your FTP program go into the etc directory/folder. This directory is in your top level directory. The way I get there it to keep moving up directories until I can’t go any further.

Once you’re in the etc directory locate the file named procmailrc. Download this file – I use ASCII transfer mode both up and down for this to keep the line endings correct. If you are able to edit the file online do so, otherwise make a backup copy of the file you downloaded before modifying it in case something goes wrong.

The file will have stuff in it you don’t need to worry about. Just look for this line

# END SPAMASSASSIN BLOCK

Immediately following the above line add these lines:


:0:
* ^X-Spam-Flag: YES
/dev/null

Your entire file may now look like this:


# Added By HostDir
VERBOSE = "no"
LOGABSTRACT = "no"
SHELL = "/bin/sh"

RESIDUE = `/bin/procmail_checker $DEFAULT $LOGNAME 2>/dev/null`
:0
* ? test $RESIDUE != "unlimited"
{
:0
* > $RESIDUE
{
LOGFILE=/proc/self/fd/2
LOG="554 - Mailbox quota exceeded by $LOGNAME
"
EXITCODE=69
:0
/dev/null
}
}
# SPAMASSASSIN BLOCK

# The condition line ensures that only messages smaller than 250 kB
# (250 * 1024 = 256000 bytes) are processed by SpamAssassin. Most spam
# isn't bigger than a few k and working with big messages can bring
# SpamAssassin to its knees.
:0
* ! ^FROM_DAEMON
* < 256000
{
:0 fw: /var/lock/spamassassin.lock
| /spamassassin
}
# END SPAMASSASSIN BLOCK

:0:
* ^X-Spam-Flag: YES
/dev/null

Now save and upload this revised file (using ASCII mode).

Send yourself a message to be sure your mail still works. And, when it comes back, open it and be sure SpamAssassin is still checking your incoming mail. Now sit back and watch to see if you get any more message SpamAssassin has identified as SPAM.

Hope you find this useful

jim