procmail
[Top] [All Lists]

Re: A Duplicates "Mystery" - The VERBOSE LOG

2004-05-20 12:42:57
On Thu, May 20, 2004 at 11:34:45AM -0500, Jack L. Stone wrote:
My global procmailrc is here:
http://www.antennex.com/tmp/procmailrc.txt



Jack, some comments about your posted rc, in order that they
occurred to me:


PATH=$HOME/bin:\
/etc:\
/bin:\
/sbin:\
/usr/bin:\
/usr/sbin:\
/usr/local/bin/formail:${PATH}

Your path should be compiled in.  I don't think there are many
good reasons for setting one explicitly post-binary.

DEFAULT=/var/mail/${LOGNAME}

Ditto with $DEFAULT.  Why isn't that the compiled-in value?

SENDMAIL="/usr/sbin/sendmail -oi -t"

$SENDMAIL is already set in the binary, and there is also
$SENDMAILFLAGS (default is "-oi").  Per the man pages,
typical usage for explicitly calling this is:

   | $SENDMAIL $SENDMAILFLAGS -t

Hmm, could this possibly be the Claudio problem?

FORMAIL="/usr/local/bin/formail"

I don't see why we need to set a var for that, especially after
such an explicit setting of path.(!)  Where else is formail going
to come from but the path we know about and set (preferably in
the binary)?

DATE=`date +.%m%d%y`

I like pulling $DATE from the messages in procmail.
I used to, in a redition of my rc from a few years ago,
call the date command, but once a day only, and update
a file.  date is a low-impact command, but still . . .


EGREP=/usr/bin/egrep
FGREP=/usr/bin/fgrep

Same comment as above.

TEST = /bin/test

I have not yet understood what the reason for this was
supposed to be from some earlier list discussions.


## Alternate Mail Deliveries
SAH=/usr/samba/mail/sa_spam${DATE}
HAM=/usr/samba/mail/sa_ham${DATE}
WORDS=/usr/samba/mail/badwords
CLAUDIO=/usr/samba/mail/claudio
DUPS=/usr/samba/mail/dups

How about building a bridge, so to speak:

PREFIX = /usr/samba/mail

CLAUDIO = $PREFIX/claudio

etc.



NASTY=/usr/local/etc/badwords.lst

You're doing a lot of var expansion.  Check your
logs for any buffer-overrun messages.  I do a
lot too, and I had to bump my $LINEBUF to 24K.


## Blank Subject Field                             
# in brackets are a caret, space, and tab          

If you called genvars first, you could use "[^$WS]".
Btw, see note below on $WS.

## Forward CDUNGER to CAT

Is Claudio writing him, too?

:0
* ^From:(_dot_)*cdunger(_at_)aol\(_dot_)com
* ^To:(_dot_)*jack(_at_)antennex\(_dot_)com
* ! ^X-Loop: jack(_at_)antennex\(_dot_)com
{
 :0
 * ^From \/[^ ]*              
 | $SENDMAIL cat(_at_)piunlimited\(_dot_)com -f ${MATCH}
}

Where are you setting your own X-Loop?


## Forward CAT to CDUNGER

Is Claudio writing him, too?
:0
* ^From:(_dot_)*cat(_at_)piunlimited\(_dot_)com
* ^To:(_dot_)*jack(_at_)antennex\(_dot_)com
* ! ^X-Loop: jack(_at_)antennex\(_dot_)com
{
 :0
 * ^From \/[^ ]*              
 | $SENDMAIL cdunger(_at_)aol\(_dot_)com -f ${MATCH}
}

Where are you setting your own X-Loop?


## Catch spam tagged from SpamAss-Milter
:0:
* ^Subject:[ ]\[SPAM Content] |^X-Spam-Status: Yes |^X-Spam-Flag: YES

You know that the trailing whitespace will have to beb present, right?



## Test if the email's Subject has bad words
:0 w:
* !
* ? $FORMAIL -x"Subject" -x"Subject:" | $EGREP -i -f $NASTY
$WORDS

## Blacklist emails FROM
:0 w:
* ? $FORMAIL -x"From" -x"From:" | $EGREP -i -f $BLACKLIST1
$REVIEW

Seems cleaner to put the blacklists much earlier; definitely earlier
than the "bad words".

INCLUDERC=$PMSRC/vsnag.rc

Btw, there is a namespace collision between vnsag's and Ruud's global
$WS.  Vsnag's is not defined with surrounding brackets.  (Thus, I can
also use, e.g.,  "[^$WS].")  I notice you use Ruud's stuff too, which
is fine; but be very careful with such namespace collisions.

MESSAGEID = `$FORMAIL -xMessage-ID:`
FROM = `$FORMAIL -xFrom:`

Both of these are already known from the vsnag run, so you can
save yourself two calls to formail and just use $H_FROM and $H_MSGID.
Of if you're not sure you will use vsnag enduringly, then

  MESSAGEID = "${H_MSGID:-`$FORMAIL -x Message-ID:`}"

etc.

:0
* ^Message-ID:

Well, you just defined $MESSAGEID, so why not use what you
defined instead of pumping all the headers through again?

  * $MESSAGEID ?? .

* ? $FORMAIL -D $MID_CACHE_LEN $MID_CACHE_FILE

If you're going to run a dupes check, why not way up-top?


RC GLOBALS
# globals.inc v.0.04 (2004-03-31)
# <http://www.xs4all.nl/~rvtol/procmail/basic>


  WS      = "[$WSP]"            # set of whitespace

Namespace collision . . .


  :0
  * ! INCDIR ?? .
  {
    INCDIR = $_
    :0
    * INCDIR ?? ^^\/.*/
    * MATCH  ?? ^^\/[^/]*(/[^/]+)*
    { INCDIR = $MATCH } # without an end-slash

Okay, for your MATCH reinstantiation in the second condition, you
could just use (I think - not tested!)

  * MATCH ?? ^^\/.*[^/]



# Messages identifying the character set in the Content-Type: *HEADER*
# (you can expand this to cover the body as well as headers, by adding
# "HB" flags)
:0 HB:
* $ ^Content-Type:.*charset=(\")?\/(${CHARSETS})(\")?\>
$GIBBERISH

You will maybe get yourself in trouble running the H flag up-top.
There is a known procmail bug such that once you do this, you can never
turn it off again subsequently.

-- 
dman

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