procmail
[Top] [All Lists]

Re: Simple Bozo-Filter Example?

1997-02-03 19:51:53
Hello.

I was wondering if anyone uses procmail for a bozo-filter and if they 
could email me a simple example.  Basically I want to keep a file with 
a list of email addresses in my $HOME or .procmail directories called 
.bozo (or the like) and have messages from email addresses in the .bozo 
file automagically redirected to /dev/null (or possibly do something 
else fun with them, like automatically email a complaint to root and 
postmaster at their domain).

If anyone would like to volunteer a simple example I would be greatly 
appreciative.


Here you go:

----- BEGIN: -----
#
# This recipe checks to see if this email is "From" a known lamer (i.e.,
# Is this lamer in my "list-of-bastards"?). If so, the email is bounced
# back via a SENDMAIL EXITCODE and the headers of the email are saved/
# GZIPped in a file so I can examine it later.  I used to bounce this
# stuff back with a generic nastygram, but with all the forged headers,
# I was getting a bunch of bounced emails.  I then set it up so email from
# certain domains got bounced to *specific* addresses, but that ended up
# being too much work.  PROCMAIL is supposed to make my life *easier* so
# I decided to go with this SENDMAIL EXITCODE bounce which seems to work
# quite nicely.  Oh, my "list-of-bastards" is kept private -- you don't
# really want all of NetCom to see *your* name in it, now do you :^}?
#
# From the sendmail source code:
#
#       /* 64 USAGE */          " 500 Bad usage",
#       /* 65 DATAERR */        " 501 Data format error",
#       /* 66 NOINPUT */        ":550 Cannot open input",
#       /* 67 NOUSER */         " 550 User unknown",
#       /* 68 NOHOST */         " 550 Host unknown",
#       /* 69 UNAVAILABLE */    " 554 Service unavailable",
#       /* 70 SOFTWARE */       ":554 Internal error",
#       /* 71 OSERR */          ":451 Operating system error",
#       /* 72 OSFILE */         ":554 System file missing",
#       /* 73 CANTCREAT */      ":550 Can't create output",
#       /* 74 IOERR */          ":451 I/O error",
#       /* 75 TEMPFAIL */       " 250 Deferred",
#       /* 76 PROTOCOL */       " 554 Remote protocol error",
#       /* 77 NOPERM */         ":550 Insufficient permission",
#       /* 78 CONFIG */         " 554 Local configuration error",
#
#
# NOTE:  This recipe will FAIL if you try and use the standard GREP/EGREP
#        on NetCom; it is unable to handle files of this length.  I have
#        GNU Grep v2.0 in my $HOME/Bin directory which CAN handle it and
#        EGREP is defined earlier (even though it's in my PROCMAIL PATH).
#
# NOTE #2:  SENDMAIL EXITCODES will not work properly unless the format
#           of your "~/.forward" file is written properly (e.g., you
#           must not allow PROCMAIL to "fail softly").  For the proper
#           format, check out "~bodysurf/.forward".
#
BASTARDLIST=$PMDIRp/list-of-bastards
:0
* ? echo "$FROM" | $EGREP -i -f $BASTARDLIST
{
        EXITCODE = 77
        :0h:
        | gzip -fc >> $PMDIRp/headers.gz
}
----- END: -----

Lates!
---------------------------------------------------------------------------
Tim <bodysurf(_at_)pobox(_dot_)com>                          
mailto:bodysurf(_at_)pobox(_dot_)com
Finger bodysurf(_at_)pobox(_dot_)com for my PGP public key (Bits 1024/KeyID 
09DA5C49).
PGP Key FPrint (09/03/94): 4C 97 F1 FA 70 55 68 91  49 D1 AD F2 DD 63 0C 15
---------------------> Please PGP encrypt your email <---------------------

<Prev in Thread] Current Thread [Next in Thread>