Mail Filtering & Antispam tools

Sorting your incoming mail can be a real chore, especially since unsolicited bulk email attacks (a.k.a. spam) have exploded in the past few years. Obscure offers three key tools to its account holders to help: procmail, SpamAssassin, and Clam AntiVirus. These three can work together to sort the mail you want to read into separate mailboxes, and keep unwelcome advertisements out of your inbox.

Cauton: Don't use these instructions if you retrive your mail using POP and use a desktop mail client.

Using the sever-based mail filtering tools works best if you read mail directly on the server using either the web mail client, or a host-based mail reader such as pine or mutt, or you use IMAP and a program such as Mozilla Thunderbirdto read your mail. If you use POP to retrieve your mail, you'll never see the messages that are filtered out unless you log in to Obscure and check your mail using a host-based tool. If you use POP to read your mail, you should either do filtering in your mail client (modern ones can do that), or you should switch to using IMAP to read your incoming mail.

Quick Start

Log in to your Obscure account via SSH, and issue this command:

startmailfiltering

This will create a simple ".procmailrc" file and pass your mail through SpamAssassin. Suspected spam will land in a folder named 'zzz.caughtspam' alongside the rest of your mail folders.

Procmail

Procmail already delivers all the mail on Obscure, and normally, it requires no special configuration. If you take a little time to configure it, though, procmail can help you deal with much larger volumes of mail than you would otherwise be able to read. Most people use procmail to separate incoming mail coming from mailing lists to separate inboxes, so that they can read those lists by topic.

The .procmailrc file installed by "startmailfiltering" has a couple entries that you can cut and paste to get you started. You can also type "man procmailex" at the Obscure command line to get more detailed help.

One nice thing about procmail is that it can help you keep track of where new mail goes in your incoming mail folders. Run this command at the shell prompt, or add it to the end of your ".bash_profile" or (for tcsh users) ".login" file:

mailstat .procmail/log

You will get a nice summary of how many messages have been delivered since you last checked (or logged in), looking something like this:


  Total  Number Folder
  -----  ------ ------
  44188      12 /var/spool/mail/myusername
   6799       2 IN.somelist
  10668       3 IN.friend
  81100      14 zzz.caughtspam
  -----  ------
 142755      31

SpamAsssassin

SpamAssassin is a very powerful antispam tool. It works in conjunction with procmail, so you have to set up procmail if you have not done so already. Instructions on doing this are spelled out below.

A very simple procmail file that enables SpamAssassin filtering is on Obscure at "/usr/local/etc/procmailrc-skel". If you use the "startmailfiltering" command described above, it will be installed in the right place for you. It will filter suspected spam into a mailbox called "zzz.caughtspam".

Once SpamAssassin has started procesing messages, it will create a ".spamassassin/user_prefs" file for you. You may want to edit this file to make sure that mail from certain people and mail addresses never gets tagged as spam. You add these people to your "whitelist". You can also add addresses to a personal blacklist, making sure they always get sent to the spam box. You can also set preferences here that affect the way SpamAssassin processes your mail here -- whether it rewrites the message subject, for instance.

# Don't mangle suspected spam messages too much
# (Possibly dangerous unless you use a text-based email reader)
rewrite_subject 0
report_header   1
defang_mime     0

whitelist_from          rbulling@obscure.org

blacklist_from          evilspammer@example.com

If you already have procmail configured in your account (you have a .procmailrc file), you can set up SpamAssassin by adding these lines to the end of your .procmailrc file.

# Make SpamAssassin tag incoming mail as spam or not
:0fw
| /usr/local/bin/spamproxy

# Store messages tagged as spam in their own mailbox
:0:
* ^X-Spam-Status: Yes
zzz.caughtspam

If you want to customize your SpamAssassin preferences further, you might look at Michael Moncur's excellent SpamAssassin Configuration Generator.

Clam Anti-Virus

Obscure now runs the ClamAV antivirus scanner on all incoming and outgoing mail. You don't have to do anything special to take advantage of this. ClamAV will discard messages containing viruses as it processes each inbound or outbound mail.

Earlier, you had to enable ClamAV through your .procmailrc. If you have this configuration in place, please remove it, as it will not pick up any extra viruses.

# Scan for viruses
:0fw
|/usr/local/bin/clamscan-procfilter.pl

:0
* ^X-CLAMAV
ZZZ.virus