procmail
[Top] [All Lists]

Re: Need help from the procmail rule gods. (simplified)

2002-11-21 11:29:18
I thought I'd take a stab at simplifying my question.

Given the following rule

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

How can I then specify more than one dependent rule using either "e" or "a" flags on this rule?

so I want two rules ie. one for each logical user that are only executed if the above filter was successfully executed. If the above filter exits with status of 1 then the mail should be delivered and processing can stop. If it exits with status of 0 then the mail should
go into spam assassin.

The problem is that the filter applies to two users. robert and ann. so I cannot just put

#anns mail
:0e:$HOME/$LOGNAME.lock
* ^TOann(_at_)elastica(_dot_)com
$ANNDEFAULT

because I also need

#anns mail
:0e:$HOME/$LOGNAME.lock
* ^TOrobert(_at_)elastica(_dot_)com
$DEFAULT

and if it's exited with 0 then spam assassin can be called up on to filter the email.

My problem is that I don't know how to tie this second rule to the exit status of the filter.

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

after that I don't mind doing something like

: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

Now I can get around my "dependent" problem because I know the filter will add a X-Challenge-Reason header to any mail that is spam. So I can add that condition to the rules. But must I do this or is there a way to specify multiple rules that are dependent the _same_ rule?

On Thursday, November 21, 2002, at 05:56  PM, Robert Nicholson wrote:

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


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