This is nothing fancy and probably lacks a lot in functionality but it =
is
what I use here. Requires a file with just a list of users =
(userlist.txt)
that you want to report for. Also requires header.inc and optional
legend.rej. Adjust the errors you want to report accordingly. I am =
sure
since I am using Lookout to post this it will wrap pretty bad.
[userlist.txt]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[header.inc]
From: Your Name <[EMAIL PROTECTED]>
Subject: E-mail Gateway Report
Reporting Gateway: Gateway Name
[legend.rej]
## LEGEND - For errors not list here please contact [EMAIL PROTECTED]
-Client host rejected: ACL Client Denied RBL - Server IP has been =
rejected
by one or more blackholes.
-Client host rejected: ACL IP Blocked - Server IP has been rejected for
local policy violations.
-Sender address rejected: ACL Sender Blocked - Address of sender has =
been
blocked for spamming activity.
-Sender address rejected: Domain not found - Address of sender does not
resolve.
-Sender address rejected: Host not found - DNS of server does not =
resolve.
-Message contains virus/Virus Signature - Message strings indicated this
message may contain a virus.
-Client host rejected: ACL Subscriber - IP belongs to a dialup/dsl/cable
range that is not authorized.
## Report provided by Your ISP
[rejuserlog.sh]
#!/bin/sh
repgate=3DYour Gateway Name
nowday=3D`date +%d`
nowmth=3D`date +%m`
nowyr=3D`date +%y`
repdate=3D`expr $nowday - 1`
basereppath=3D/yourbasedirectory
for a in `cat $basereppath/userlist.txt`
do
incdel=3D`zgrep -c ''$a'.*sent' -i /var/log/maillog.0.gz`
outdel=3D`zgrep -c ': from=3D<.*'$a'>' -i /var/log/maillog.0.gz`
totrej=3D`zgrep -c 'reject.*'$a'' -i /var/log/maillog.0.gz`
totipbl=3D`zgrep -ce "rejected.*ACL IP Blocked.*$a" -i
/var/log/maillog.0.gz`
totsdbl=3D`zgrep -ce "rejected.*ACL Sender Blocked.*$a" -i
/var/log/maillog.0.gz`
totrbl=3D`zgrep -ce "rejected.*ACL Client Denied RBL.*$a" -i
/var/log/maillog.0.gz`
totmky=3D`zgrep -ce "rejected.*ACL Client Denied MKY.*$a" -i
/var/log/maillog.0.gz`
totdnf=3D`zgrep -ce "rejected.*Domain not found.*$a" -i
/var/log/maillog.0.gz`
tothnf=3D`zgrep -ce "rejected.*cannot find your hostname.*$a" -i
/var/log/maillog.0.gz`
totbod=3D`zgrep -ce "reject.*body.*$a" -i /var/log/maillog.0.gz`
tothead=3D`zgrep -ce "reject.*header.*$a" -i /var/log/maillog.0.gz`
totbl=3D`zgrep -ce "554 Service unavailable.*$a" -i =
/var/log/maillog.0.gz`
subsrej=3D`zgrep -ce "ACL Subscriber.*$a" -i /var/log/maillog.0.gz`
cat << EOF > $basereppath/users/$a.txt
Gateway Report for $a on $nowmth/$repdate/$nowyr
Total Incoming Messages Delivered to $a : $incdel
Total Outgoing Messages Delivered from $a : $outdel
Total Messages Rejected : $totrej
Total ACL IP Blocked : $totipbl
Total Sender Blocked : $totsdbl
Total Client Denied RBL : $totrbl
Total Blackhole Rejections : $totbl
Total Client Denied MKY : $totmky
Total Domain Not Found : $totdnf
Total Host Name Not Found : $tothnf
Total Body Check Rejects : $totbod
Total Header Checks Rejects : $tothead
Total Subscriber Network : $subsrej
EOF
echo "See reject details at the lower portion of this report" >>
$basereppath/users/$a.txt
printf "\n" >> $basereppath/users/$a.txt
echo "## Reject Details" >> $basereppath/users/$a.txt
zgrep -e 'rejected.*'$a'' -i /var/log/maillog.0.gz | cut -d ":" -f
7-10 |\
sort >> $basereppath/users/$a.txt
zgrep -e 'reject.*body.*'$a'' -i /var/log/maillog.0.gz | cut -d =
";" -f
2-10 |\
sort >> $basereppath/users/$a.txt
zgrep -e 'reject.*header.*'$a'' -i /var/log/maillog.0.gz | cut -d =
";"
-f 2-10 | sort >> $basereppath/users/$a.txt
zgrep -e '554 Service unavailable.*'$a'' -i /var/log/maillog.0.gz =
|
cut -d ";" -f 2-10 | sort >> $basereppath/users/$a.txt
cat $basereppath/header.inc $basereppath/users/$a.txt
$basereppath/legend.rej |\
/usr/sbin/sendmail $a
rm $basereppath/users/$a.txt
done
exit 0
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of SWIT
> Sent: Saturday, September 13, 2003 3:44 PM
> To: [EMAIL PROTECTED]
> Subject: [IMGate] Re: thought about a report to each user...
>=20
>=20
>=20
> A guy named Don Weber did I think. but its not there anymore.=20
> Or at least when I click thru the url in an old message its 404 now.
>=20
> I have been looking for one. I think I am mssing some of the=20
> .sh files I used to run. Well I know I am.
>=20
> if you find one I be interested in it and also your reports=20
> script. Thanks Mark
>=20
> ----- Original Message -----=20
> From: "Tom Baker|Netsmith Inc" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, September 13, 2003 2:05 PM
> Subject: [IMGate] Re: thought about a report to each user...
>=20
>=20
> >
> > I will gladly share this script when its done...
> > Anyone have an "imgate scripts/tweaks" collection page going on?
> >
> >
> >
> > -----Original Message-----
> > From: Tom Baker|Netsmith Inc [mailto:[EMAIL PROTECTED]
> > Sent: Saturday, September 13, 2003 12:46 PM
> > To: '[EMAIL PROTECTED]'
> > Subject: [IMGate] Re: thought about a report to each user...
> >
> >
> >
> > -----Original Message-----
> > From: Len Conrad [mailto:[EMAIL PROTECTED]
> >
> > > I've thought about adding such a report to IMGate that is=20
> mailed to=20
> > > each recipient, so every recipient can see his rejects for=20
> > > yesterday, but I figured it would just open up a ton of=20
> phone calls=20
> > > and emails about what
> > is
> > > perfectly, accurately nothing but spam.
> >
> >
> > Thanks for the good idea Len! :)
> > Not for ever stupid customer to receive but its damn nice to get a=20
> > daily summary to keep an eye out for people who I do want mail from!
> >
> > I just used a variable to control what users get the=20
> report. Working=20
> > on variable detail now (idiots just get senders, no=20
> detail.. however I=20
> > will want the reject reasons personally)
> >
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> > Sent: Saturday, September 13, 2003 12:38 PM
> > To: [EMAIL PROTECTED]
> > Subject: SPAM Filter Report
> >
> >
> > Total Senders Refused: 7
> > Total Senders Trapped: 13
> > Total Senders Deleted: 116
> >
> >
> > -- WebMail Folder (10) : spam-mid --
> > [EMAIL PROTECTED]
> > ..
> > [removed due to body filters]
> > ..
> >
> > -- WebMail Folder (3) : spam-hi --
> > [removed due to body filters]
> >
> > -- DELETED MAIL (116) --
> > [removed due to body filters]
> >
> > -- REFUSED MAIL (7) --
> > [removed due to body filters]
> >
>=20
>=20
>=20