1) Have qmail-scanner increment the number in a file for the number of times a class C hits the delete threshold.
2) Add an additional check to qgreylist for that file, and if it reached a configurable threshold, 5.7.1 the email
3) Add a cleanup function that runs every hour and removes files that haven't been written to in 24 hours.
I'm making a stab at #1, but running into issues. I've added the following at around line 3770 (the delete section), but it isn't kicking out the files at all. Sigh. Anyone see any reason why this wouldn't generate a file and then increment a number inside of it?
Code: Select all
#Add in spamhits to greylisting files
my ( $a, $b, $c, $d ) = $ENV{'TCPREMOTEIP'};
my $bl_file = "/var/qmail/blacklist/$a.$b.$c";
open (FILE, "+>>" . $bl_file);
flock(FILE, 2);
seek FILE, 0, 0;
my @file_contents = <FILE>;
truncate FILE, 0;
my $counterVar;
if ($file_contents[0] =~ /^(\d+)$/)
{
$counterVar = $1;
}
else
{
$counterVar = 'COUNTER ERROR'; # the regular expression didn't match
}
$counterVar++;
print FILE $counterVar;
close (FILE);