procmail
[Top] [All Lists]

More reason to use GNU fgrep in procmail filters

1997-11-17 06:28:16
More reason to use GNU or xpg4 fgrep in your procmail filters:
 a) Bug in the -i option (previously discussed in 
procmail(_at_)Informatik(_dot_)(_dot_)(_dot_))
 b) Limit on handling lists 

--------< cut here for more detailed information >----------
From: "Andrew Beckett" 
Date: Sat, 15 Nov 1997 00:38:04 +0000
X-Mailer: Z-Mail (4.0.1 13Jan97)
To: Cadence procmail & zmail users
Subject: Warning - standard fgrep has limit on file size

If you're using the fgrep method to trap spammers simply by using the
fgrep rule in your procmail setup (potentially together with
zmail to easily "ban" spammers at a single click of a button), you 
should be aware of the fact that the standard fgrep on SunOS 4.x & 
on Solaris 2.x has a major limitation - it can't cope with long lists.

For example, the section from my rc.spammers was:

:0hb
* ?formail -I Subject | fgrep -s -f $PMDIR/banned
    {
     EXITCODE=77
     :0:
     automated/junk
    }

Where $PMDIR/banned contained a list of banned spammers of the form:
    A(_at_)bigfoot(_dot_)com
    Aaron(_dot_)W(_dot_)Mitchell(_at_)ix(_dot_)netcom(_dot_)com
    All(_at_)rapidconect(_dot_)com
    BdavidC(_at_)savoynet(_dot_)com
    Broker(_at_)lostvegas(_dot_)com
    etc.

This worked for a few months, but, unfortunately this fgrep recently 
failed when my banned list contained 370 entries in it. The error was:
    wordlist too large

Taking into account that, and the fact that the Solaris 2.5.1 fgrep has 
a known bug where the -i (case insensitive option) doesn't work properly,
there are at least two solutions:
    1. On Solaris 2.5 upwards, use /usr/xpg4/bin/fgrep
    2. On other machines, use gnu fgrep.

Unfortunately, my mail server is running Solaris 2.4, so I've ended
up compiling gnu fgrep on SunOS, and then running it in comnpatibility mode
on the server. It wouldn't compile properly under Solaris 2.4. We'd
upgrade the server, but it's a lot of grief....

So, my current SunOS 4.x banning recipe looks like:

:0hb
* ?formail -I Subject | $PMDIR/fgrep -q -i -f $PMDIR/banned
    {
     EXITCODE=77
     :0:
     automated/junk
    }

Regards,
Andrew.
-- 
*************************************************************
* Andrew Beckett               * Tel:   +44 1344 360333     *
* Lead Applications Engineer   * Fax:   +44 1344 360324     *
* Cadence Design Systems Ltd   * Email: andrewb(_at_)cadence(_dot_)com *
* Bagshot Road                 *                            *
* Bracknell.  RG12 3PH         *                            *
*************************************************************

<Prev in Thread] Current Thread [Next in Thread>
  • More reason to use GNU fgrep in procmail filters, John Gianni <=