[rt-users] permanently squelching a user

Joseph Spenner joseph85750 at yahoo.com
Fri May 23 16:57:42 EDT 2008


--- On Fri, 5/23/08, Kimberly McKinnis <kmckinnis at tivo.com> wrote:

> Yes please! I'll drop it onto my RT testbed and see how
> it incorporates
> into the system. I originally thought there must be a
> simpler way to do
> this, but procmail wasn't working out either. 
> 
> 
> 
> I've written a multi purpose
> 'spam/text/sender/receiver filter' which
> sits between sendmail/postfix and RT.  Basicially, it works
> like this:
> 
> Instead of having an entry in /etc/aliases pointing to RT,
> the alias
> points to my script.  The script analyzes the whole email
> and looks for
> certain text strings.  If they exist (or don't exist,
> depending on the
> need), it opens a pipe to RT and passes the email along; if
> the
> conditions are met where it shouldn't go into RT,
> it's dropped.

Here's my script:

-----

#!/usr/bin/perl

# put the contents of the message into an array
@originalMessage=<STDIN>;

@scanThis=@originalMessage;

# weed out the html tags
foreach $line (@scanThis) {
        $line =~ s/\<[^\>]*\>//g;
        }

# get message into a string so we can search it
$messageString1=join(" ", @scanThis);
$messageString2=join(" ", @originalMessage);

$messageString = "$messageString1 $messageString2";

# get all the bad content lines from datafile
open (BADLINES, "/home/gman/scripts/badlines.txt");
@badlines=<BADLINES>;
close BADLINES;

# if the message contains bad content, exit
foreach $line (@badlines) {
        chomp $line;
        if ($messageString =~ m/$line/i) {
                exit 0;
                }
}

# we found nothing bad, so pass it through to RT
open (PIPE, "|/opt/rt2/bin/rt-mailgate --queue customer_probs --action correspond");
print PIPE @originalMessage;
close PIPE;

----

I'm still using RT2, and the line:
"|/opt/rt2/bin/rt-mailgate --queue customer_probs --action correspond"

is directly from /etc/aliases.  I'm not sure how it is done in RT3, but I'm sure it's similar.

The file:
/home/gman/scripts/badlines.txt
Should contain text strings which have content to cause the message to never make it to RT.  Each line should contain its own text to block.

You may need to escape certain characters, such as "@" and "*".  Here's a section of my badlines.txt:

vi\@gr\@
F\*R\*E\*E
health insurance rates
chat with singles
100% risk free
EXERC1SE

Each line of the badlines.txt should contain text you want to block.



      



More information about the rt-users mailing list