procmail
[Top] [All Lists]

Re: filtering just some accounts

2004-11-16 10:50:37
At 08:31 2004-11-16 -0600, Paul Crittenden wrote:
I set up a list of all students and then set up a rule to look through that list and if they were on it filter out any spam. Here are 2 rules I tried that didn't work.

Include them in a GROUP (an actual unix system group), then use 'groups username' instead of some grep operation.

Try number 1:
:0:
* ^X-Spam-Status: Yes
* ? fgrep -iqf /etc/students
/usr/users/truncmail/spam/ac-spam

Er, and what exactly are you grepping the students file AGAINST? I'd venture that it's a lot more than you think.

Chances are, you have a very basic student name and it's matching something in the headers. A handful of basic student names, and you'll match virtually everything.

Try number 2:
:0:
* ^X-Spam-Status: Yes
* ? (formail -x To: | fgrep -iqf /etc/students)
/usr/users/truncmail/spam/ac-spam

For one, the To: header is entirely too vague to match against (note your delivery from THIS list doesn't contain your email address in the To: header), and again, a very basic student name can match a lot of stuff. Have a student named "ed". and he'll match the '.edu' domain portion.

Instead, use $LOGNAME to get the login name of the user being delivered for (assuming that the webmail users actually have system logins and aren't instead being handled via some voodoo).

:0:
* ^X-Spam-Status: Yes
* ? grep -w $LOGNAME /etc/students
/usr/users/truncmail/spam/ac-spam

or, by creating a group 'webspam' and assigning all users who are subjected to it:

:0
* ^X-Spam-Status: Yes
{
        GROUPS=`groups $LOGNAME`

        :0:
        * GROUPS ?? [   ]webspam\>
        /usr/users/truncmail/spam/ac-spam
}

This could more generically be "tossspam" or something like that. Note that the output format of the groups program can vary between some OS', so you should verify the syntax of different users (one with only a single group, another with multiple) at a command prompt first.

Also, I was getting a "list to long" error message. Apparently there is a limit on how many entries can be in a list, can you tell me what it is?

"was getting". Probably with some particular incarnation of your grep operation?

Procmail doesn't manipulate 'lists' per se - so obviously, you are running into some limit imposed by your shell (say, by having an '*' for a filespec on the grep operation and being in a rather large dir).

I know gnu grep can handle a rather large list (much larger than your user list is likely to be), but the -f argument makes it really go to town on your memory (several magnitudes greater than the size of the list) because it is highly inefficient in that mode. So much so that I wrote my own purpose-built grep tool for manipulating lists.

Deja^H^H^H^HGoogle Groups might provide you some insight as to the error message (unrelated to procmail):
<http://groups.google.com/groups?q=grep+%22list+too+long%22&hl=en&btnG=Google+Search>

---
 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 homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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