procmail
[Top] [All Lists]

Need help from the procmail rule gods.

2002-11-21 04:00:54
My problem is that I need to use flags "e or a" but I wish to refer to the rule they are dependent on.

Meaning that I don't want the rules to be order dependant.

I'll breifly describe what I have setup.

I have a shell account username "steffi" and it front ends all users at my domain elastica.com

There's me "robert" and my wife "ann" and I'd like to duplicate all functionality I have for all users.

Basically I want to do the following.

As mail comes in.

run filtmail script which filters mail appropriately for either ann or robert.

This filter either exits 1 or exits 0. ie. the filter when the mail is accepted exists with a status of 1 whenever it exists with 0 that mail is considered spam by filtmail and should then be passed off to spamassissin.

I run into a little bit of a problem because I'm running two anti spammers but this is because filtmail does more than just identfy what it thinks as spam.

If filtmail determines that the mail is not spam. That then I do not wish that mail to go through to spam assassin. Only mail that filtmail deems to be spam should go into spamassassin. I can live with false positives from filtmail as it's rules are very strict. Basically if the sender isn't on a list then are seen to be spam.

So, I have to users ann(_at_)elastica(_dot_)com and 
robert(_at_)elastica(_dot_)com

I want to provide filtmail and spamassassin functionality for both users.

This is where things get a little nasty.

In my procmailrc rules I still have to match specifically on the intended recipient of the message in order to direct the mail to the correct mailbox. Currently I cheat in that mail to robert goes to $DEFAULT so I special case anns mail only. I can change this if necessary.

But again the key thing I want is for both users to only forward email to spamassassin if filtmail deemed it spam. I do not know how to use "e or a" syntax for more than one rule positioned after the dependent rule.

Filtmail will append an X-Challenge-Reason header whenever the message is considered spam so I'm currently cheating by using that as a indicator that filtmail has decided that mail is spam and so match on that header in some rules. I would like to be able to structure this logic without relying on the presence of any token in the mail. ie. based on the exit status.

So what I want to know is how one specifies "a or e" condition flags for a rule by naming that rule regardless of when it occurred prior to the _current_ rule.

Remember, filtmail will correctly exit 1 or 0 for both my users so it doesn't matter which users mail filtmail sees. What I'm concerned about is how I conditionalize spamassasin for when it exits with a 1 exit status.

:0 Wf:$HOME/filtmail.lock
| $HOME/.filtmail/filtmail

# HERE the idea is that if ^X-Challenge-Reason isn't present then this mail is not spam
# and go through directly to anns mailbox.

#anns mail
:0:$HOME/$LOGNAME.lock
* ^TOann(_at_)elastica(_dot_)com
* !^X-Challenge-Reason
$ANNDEFAULT

# HERE the idea is that if X-Challenge-Reason is present then filtmail said it was spam # and it should go through to spamassassin. Currently it isn't setup that way.

:0:$HOME/LOGNAME.lock
* ^TOann(_at_)elastica(_dot_)com
* ^X-Challenge-Reason
$ANNSMAILDIR/copy

#because of procmail bug that causes From_ line to disappear.

:0hf
* ^^rom( )
| sed '1s/^rom/From/'

:0fw
* < 25600
* !^Subject:.*4321
| $SPAMASSASSIN

# HERE I want to handle mail spamassassin has identified as spam but I need to do it for #each user. In order to allow for other users(_at_)elastica(_dot_)com I can live with that mail going to
#$MAILDIR/copy and $DEFAULT when no rules match.

:0:
* ^X-Spam-Level: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
* ^TOann(_at_)elastica(_dot_)com
$ANNSMAILDIR/copy

:0:
* ^X-Spam-Level: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
$MAILDIR/copy

:0:
* ^TOann(_at_)elastica(_dot_)com
* ^X-Spam-Status: Yes
$ANNSMAILDIR/copy

:0:
* ^X-Spam-Status: Yes
$MAILDIR/copy

# Work around procmail bug: any output on stderr will cause the "F" in "From"
# to be dropped.  This will re-add it.
:0 H
* ! ^From[ ]
* ^rom[ ]
{
  LOG="*** Dropped F off From_ header! Fixing up. "

  :0 fhw
  | sed '1s/^^rom/From/'
}

I realize that this currently will send all "robert's" mail that goes through filtmail regardless of whether the exit status 1 or 0. I'll change that so that only mail that mail deems to be spam hits spamassassin. Again I'd rather rely on the exit status of the filter than the presence of X-Challenge-Reason.

Can I solve my problem using scopes?


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