procmail
[Top] [All Lists]

Re: Blacklist

2003-02-03 10:52:30
At 13:11 2003-02-03 +0100, Frank =?UNKNOWN?Q?N=F8rvig?= wrote:

How can I make a blacklist-script to sort out specific domains using procmail ?
I have tried doing the follwing but it only catches about 50% :

It really helps if you provide a snippet from a VERBOSE=ON LOG which shows this recipe failing against a message containing a domain which is listed.

You ARE using VERBOSE logging, right? The procmailrc you provided doesn't include any of the typical configuration setup components which people might otherwise use.

For that matter, taking saved messages and throwing them at your recipe situated in a "sandbox" would allow you to examine them and tweak your recipe as needed (without actually sending any bounce messages and without needing to wait for the next spew to come from one of these senders). See my .sig for more info on the sandbox technique I employ.


I'd suggest that you put the "cheap" checks at the top - move the inverted FROM_DAEMON and X-Loop checks to the top (in fact, put X-Loop at the very top, because it's the simplest expression). As your blacklist grows, it'll make more sense to skip the check if those already fail it - you'll probably graduate to just using a grep process against an external file, and that's a needless waste of cycles when the other expressions would possibly reject the message anyway.

Lose the lockflag on the outer recipe. If you examine your logs (which, everyone should be doing before inquiring as to why something doesn't work), you'll find that you're receiving "Extraneous local lockfile ignored" or somesuch. That recipe depth isn't writing to a file, so the lockfile is meaningless, and also a lockfilename cannot be determined.

{
    :0 hbwc
    | gzip >> /home/$TO/spam.backup

This recipe however should have the lockfile flag. It also doesn't need 'hb', which together are the default. You _really_ don't want 'w' - if for some reason gzip failed, you'd have _two_ copies of the message floating about for procmail to contend with - and the c already ensures that you'll have one for your other proceses. A .gz extension on the backup file is a nice way to indicate that it's a gzipped file. You might even want to use '-9fc' for the arguments to gzip - if you're going to compress, may as well compress well.

   :0
    | ( \
       echo "To: $FROM";\
       echo "From: $MODTAGER";\
       echo "Subject: Blacklist notify";\

Where do I begin? Well, simply put, sending messages in response to spam (and from the list of domains in your blacklist, that seems to be what you're doing), is never a good idea. You're better off using EXITCODE to simulate a delivery failure. And you really don't want _your_ address on the From:, since it invites an further reply from them.

     ) | $SENDMAIL -U $FROM

FTR,

        $SENDMAIL -t

would work just as well, since the recipient is the sole address listed in the headers of the message you're sending.

---
 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>
  • Blacklist, Frank =?unknown?q?N=F8rvig?=
    • Re: Blacklist, Professional Software Engineering <=
    • Re: Blacklist, LuKreme