The Scarpaz.
The Scarpaz Site
:: Your unreliable online reference documentation on the Scarpaz. ::
:: Via malfidinda reta dokumento de referenco pri la Skarpac. ::
Counter image

Navigation: > [Home page] > [Napalm] [Alphabetical Index]     [Tree View]

Napalm: a free anti-spam solution

Click here to download Napalm 0.3

Spam, also known as unsolicited commercial e-mail, is becoming an unbearable annoyance. I'm currently receiving approximately 100 spam messages every day. Conventional mail filters integrated in most e-mail client programs like Eudora or Outlook Express are uneffective, since in most cases they simply delete spam messages after downloading to your machine, that is when it's too late. The ideal solution would be to implement a server-based filter, but most people have no administrator or root access, respectively, to their mail server.

Napalm is a simple Tcl-based script designed to transparently connect to a POP3 server and remove all the unsolicited commercial e-mail messages, according to an easily definable set of rules.

Unlike most e-mail client programs, Napalm is extremely efficient because it manages to perform its cleansing operations by working on message headers only: this means that message bodies are never downloaded to your computer. This avoids any bandwidth and disk space wastage.

Please note that Napalm is not a server-based solution. In fact it connects to your mail server exactly as your favourite e-mail client does. This makes its installation process extremely simple: you do not need to set up any mail processing programs and you do not need to change your existing program settings.

How to install and set-up Napalm

Please carefully read all the instructions below. Improper use of Napalm can result in the loss of all your mail messages!

Napalm requires Tcl, which is normally available in any Linux distributions. I don't know exactly which minimum version is ok. I tried it with 7.5 an 8.0 and it worked fine.

  1. Download it in your home directory; then unpack it by typing the following command:
    tar xvzf Napalm-0.3.tar.gz

    Unzipping the archive will create a subdirectory called Napalm under your home. Note that Napalm must be installed into ~/Napalm, otherwise its internal directory change mechanism won't work. This mechanism is required for the program to be launched by cron, as described below.

  2. You should now have a subdirectory named Napalm under your home. Locate in it a file named Napalm.conf and modify its contents in order to reflect your e-mail account settings. The original content of the file is provided below as an example:
    set hostname "pop_server.your_provider.com"
    set port 110
    set username "put_here_your_user_name"
    set password "put_here_your_password"
    set verbose 0

  3. In the same directory you should find another file, named Napalm.rules. This file contains the rules that defined which messages are to be delete: it is your responsibility to modify these rules in order to fit your needs. Please note that poorly designed rules can delete not only undesired messages but also good ones too! An example file is already provided; rules are defined as follows:
    ù kill $from "*dealsonline*"
    kill $from "*Offers*"
    kill $from "*tremendousrewards*"
    kill $from "*sweepsclub*"
    kill $subject "*Lose*Pounds*"
    kill $subject "*Open Any Lock with*"
    More formally, you have to specify one rule per line, with the following syntax:
    kill $field_name "pattern"
    where field_name can be one of the following: from, to, subject; and pattern is a case-insensitive glob-style pattern (where '?' represents any possible character and '*' any possible string). Pattern recognition is performed by the string command of the Tcl language. To learn more on how patterns are matched, just type the following command:
    man n string
    and read the “string match” paragraph;

  4. It's now time to manually test your Napalm configuration. Just type:
    ./Napalm
    If you correctly specified your account settings, you should see something like below:

    /[2002-10-20 20:20:56] Napalm entering war theater, Sir.
    ! Connecting to host: popmail.libero.it, port: 110
    | Server: [+OK POP3 PROXY server ready (6.5.001) <2B49EC1753641E6A0E69F6A2C614864A3EBF7E6D@pop.provider.com>]
    | Server: [+OK Password required]
    | Server: [+OK 11 messages]
    | 01: From: ["sender1" <sender1@mail.com>] To: [you <name@provider.com>] Subject: [subject1]
    | 02: From: ["sender2" <sender2@mail.com>] To: [you <name@provider.com>] Subject: [subject2]
    ...
    | 08: From: ["Bad Guys" <badguys@mail.com>] To: [you <name@provider.com>] Subject: [spam]
    X Napalm killed 08: From: ["Bad Guys" <badguys@mail.com>] To: [you <name@provider.com>] Subject: [spam]
    | 09: From: ["sender9" <sender9@mail.com>] To: [you <name@provider.com>] Subject: [info]
    | Server: [+OK POP3 server closing connection]
    \ [2002-10-20 20:21:00] Napalm completed operations with 1 confirmed killings, Sir.
    Every time a message is deleted, an entry is added to file Napalm.log describing the deleted message, like as follows:

    [2002-10-21 14:50:05] X From: ["spammer" <spammer@mail.com>] To: [me@provider.com] Subject: [5 Books For $1 Plus a FREE Attach].

    If you desire a more verbose log file, just modify Napalm.conf by changing variable verbose from 0 to 1, in this case all the messages sent to the console are added to the log file.

  5. When you are happy with your configuration, you are ready to instruct cron to run Napalm periodically. In order to do this, make sure that the crond daemon is running on your machine; this can be verified on a Red Hat machine by typing:

    service crond status
    If crond is not running, configure it and start it (there are lots of FAQ's and HowTo's that describe how to do it), then prepare in your home directory a file, named crontab, containing the following lines:

    0 0-23/1 * * * /root/Napalm/Napalm.tcl
    15 0-23/1 * * * /root/Napalm/Napalm.tcl
    30 0-23/1 * * * /root/Napalm/Napalm.tcl
    45 0-23/1 * * * /root/Napalm/Napalm.tcl

    The meaning of the above lines is that Napalm is started every 15 minutes, at any hour, in any day, month and year. Then you have to instruct cron to use this file by typing:

    crontab crontab

  6. You're done.


Document size: 8012
This document was last modified on 2004-04-16 21:36:53

Navigation: > [Home page] > [Napalm] [Alphabetical Index]     [Tree View]

MajaMaja is powered by the Tcl Language. This page was last updated on 2004-12-26 at 18:22:41.
This site was automagically generated by MajaMaja, a simple and easy to use web content manager written in Tcl by scarpaz <scarpaz@scarpaz.com>.