Hi!
The output of this script is a bit cryptic as it shows raw log lines. But the
users who request most such emails are advanced users who can be taught how to
interpret it. We have subject logging activated so they will be able to read
the Subject lines from the logs.
We're using postfix and we've setup a seperate (internal) domain
(spamreport.ourdomain1.com)
In master.cf we've added the following:
spamreport unix - n n - - pipe
flags=F user=nobody
argv=/usr/bin/perl /usr/local/bin/spamreport.pl ${sender} ${recipient}
And this is the script (you need to insert your own domains and paths into the
script. It wasn't really written for other than internal usage):
#!/usr/bin/perl
#
# (C)Lars Troen
#
my $sender=$ARGV[0];
my $recipient=$ARGV[1];
if(!$sender=~/[ourdomain1.com|ourdomain2.com]/i){die "bad domain";}
if($recipient=~/[EMAIL PROTECTED]/i){
my $a="/bin/grep -i $sender /home/assp/maillog.txt|/bin/grep delayed";
my $delayed=`$a`;
my $bayesian=`/bin/grep -i $sender /home/assp/maillog.txt|/bin/grep 'Bayesian
Spam'`;
my $dnsbl=`/bin/grep -i $sender /home/assp/maillog.txt|/bin/grep 'failed
DNSBL'`;
open(FILE,">/tmp/$sender.txt") || die("can't open $recipient file: $!");
print FILE 'From: Email filtering system <[EMAIL PROTECTED]>'; print FILE
"\n";
print FILE "To: <$sender>\n";
print FILE "Subject: Epostrapport\n";
print FILE "X-Client: Lars sitt perlscript 1.0\n\n";
if ($bayesian){print FILE "\n\nEmails blocked because of content:
\n$bayesian";}
if($dnsbl){print FILE "\n\nEmails blocked because of black listed servers:
\n$dnsbl";}
if($delayed){print FILE "\n\nEmails from 'unknown' senders (you might have
received many of these): \n$delayed";}
close(FILE);
`/usr/sbin/sendmail $sender </tmp/$sender.txt`;
unlink "/tmp/$sender.txt";
}
else {
open(FILE,">/tmp/$sender.txt") || die("can't open $recipient file: $!");
print FILE 'From: Email filtering system <[EMAIL PROTECTED]>'; print FILE
"\n";
print FILE "To: <$sender>\n";
print FILE "Subject: Unknown address\n\n";
print FILE "Email address \<$recipient\> is unknown.\n\n";
print FILE "Valid address: info\n";
close(FILE);
`/usr/sbin/sendmail $sender </tmp/$sender.txt`;
unlink "/tmp/$sender.txt";
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of James Brown
Sent: Monday, August 18, 2008 9:42 AM
To: Questions and Answers for users of ASSP Anti-Spam SMTP Proxy
Subject: Re: [Assp-user] Informing Users (Parse The Logs)
On 18/08/2008, at 5:28 PM, Lars Troen wrote:
We're also using a similar solution (written in perl) where a user can send an
email to a specific address to request the latest stats for his/her email
address.
Lars
Hi Lars. This sounds interesting.
Are you able to share the script? Does it show any info about the messages
blocked, or just stats?
James.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Assp-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/assp-user