How to RT-admins handle mail loops (bounces)?

SSIA, :wink:

Tomas A. P. Olaj, email: tomas.olaj@usit.uio.no, web: folk.uio.no/tomaso
University of Oslo / USIT (Center for Information Technology Services)
System- and Application Management / Applications Management Group---------- Forwarded message ----------
Date: Wed, 7 Feb 2007 11:38:33 +0100 (CET)
From: Tomas Olaj tomaso@ulrik.uio.no
Reply-To: Tomas Olaj tomas.olaj@usit.uio.no
To: rt-users@lists.bestpractical.com
Subject: mail loop problems: was: Re: [rt-users] RT/Apache suddenly hangs

Hi,

We have checked the problem more closesly, and the reason why our RT/Apache
server stops is due to different variants of mail loops.

We still have problems with other loop variants consuming all resources.
Extended mailgate errors leading to loops, spam going into loop. How can we
make mailgate a bit more smarter?

Does anyone have a mail loop detector in front of their RT installations.

We have a high severity now with our RT in production. The load is increasing
all the time.

Our commonly used cron-script removing some mail loops:

#!/site/perl-5.8.7/bin/perl

Author: Petter Reinholdtsen

Date: 2006-01-13

License: GNU Public License v2 or later

Look at all tickets, and remove all queue addresses from requestor,

cc and admincc. This reduces the amount of bounce emails sent to

the RT admins.

use warnings;
use strict;
use Getopt::Std;

Location of RT’s libs and scripts

Remember to change to correct path on current RT instance

use lib (“/site/rt3/local/lib”, “/site/rt3/lib”);

package RT;

use RT::Interface::CLI qw(CleanEnv);
use RT::Queue;
use RT::Queues;
use RT::Tickets;

my %opts;
Getopt::Std::getopts(“dn”, %opts);

my $debug = $opts{‘d’} || 0;
my $dryrun = $opts{‘n’} || 0;

$| = 1;

Find all queue addresses of enabled queues

my @queueaddrs =
(
# Aliases for e-mail lists are listed here:
‘e-mail-list@domain.com’,
);

my $ticketcount = 0;
my $starttime = time();

CleanEnv(); # Clean our the environment
RT::LoadConfig(); # Load the RT configuration
RT::Init(); # Initialise RT

my $user = RT::User->new( $RT::SystemUser );

Merge static list with dynamic list

@queueaddrs = (load_queue_addresses(), @queueaddrs);

Loop over all addresses, remove them from the tickets were they are

registered as watchers

for my $address( sort @queueaddrs ) {
print “Removing address ‘$address’ from all tickets\n” if $debug;
my $tickets = new RT::Tickets($RT::SystemUser);
$tickets->FromSQL( “Watcher.EmailAddress = ‘$address’” );
while( my $ticket = $tickets->Next ) {
$ticketcount++;
my $id = $ticket->Id;
if ($dryrun) {
print “Want to remove $address as watcher from ticket #$id\n”;
} else {
$RT::Logger->info("Removed queue address $address as watcher ".
“from ticket #$id”);
$ticket->DeleteWatcher(Email => $address, Type => $_ )
for( qw(Cc AdminCc Requestor) );
}
}
}

my $duration = time() - $starttime;
$RT::Logger->info(“Processing of $ticketcount tickets took $duration seconds”);

sub load_queue_addresses {
my $queues = new RT::Queues($RT::SystemUser);
$queues->LimitToEnabled();
my @queueaddrs;
foreach my $queue (@{$queues->ItemsArrayRef()}) {
for my $address ($queue->CorrespondAddress, $queue->CommentAddress) {
next unless $user->LoadByEmail( $address );
push @queueaddrs, $address;
print “Found queue address ‘$address’\n” if $debug;
}
}
return @queueaddrs;
}

Tomas A. P. Olaj, email: tomas.olaj@usit.uio.no, web: folk.uio.no/tomaso
University of Oslo / USIT (Center for Information Technology Services)
System- and Application Management / Applications Management Group

Procmail rules.

Mathew

Tomas Olaj wrote:

SSIA, :wink:

mail loops or bounces? these are two different things.

mail loops should be handled by RT. I tried to fake it by making a
custom scrip condition to throttle replies to the same address over a
period of time, but there is no place to stash a “last sent time” and
"number of messages sent" in a user record that i could find. we’ve
had our share of autoresponder wars and have to manually intervene by
disabling the on create scrip.

as for bounces, I posted on the wiki in the contrib section details
of how I link them back to the originating ticket so you know when a
customer response failed.

smime.p7s (2.47 KB)