Inhaltsverzeichnis

!!! ACHTUNG - evtl. veraltet - ACHTUNG !!!

Diese Seite wurde zuletzt am 9. Juli 2014 um 08:55 Uhr geändert.

~/.my.cnf (für den Benutzer root)

 [[client]]
 host=<HOST>
 user=root
 password=<PASSWORD>
 database=dspam

platzhalter

(Die Rechte sollten nur lesen für root (chmod 400 ~/.my.cnf) sein!)

/usr/local/sbin/qmail-smtpd-log-stats.sh (dash-kompatibel)

 #!/bin/sh
 if [[|0 != $( id -u ) ]]; then echo 'You have to be root! - EXIT...'; exit 1; fi
 LDIR="/var/log/qmail/smtpd"
 echo -n "ripmime (ATTACH):\t\t"
 grep "ATTACH" $LDIR/@* $LDIR/current | wc -l
 echo -n "spamassassin (SPAM):\t\t"
 grep "SPAM REJECT" $LDIR/@* $LDIR/current | wc -l
 echo -n "clamav (VIRUS):\t\t\t"
 grep "VIRUS" $LDIR/@* $LDIR/current | wc -l
 echo -n "tcpserver (No Reverse DNS):\t"
 grep "451 No Reverse DNS" $LDIR/@* $LDIR/current | wc -l
 echo -n "rblsmtpd (cbl.abuseat.org):\t"
 grep "451 Blocked.*cbl.abuseat.org" $LDIR/@* $LDIR/current | wc -l
 echo -n "rblsmtpd (www.sorbs.net):\t"
 grep "451.*www.sorbs.net" $LDIR/@* $LDIR/current | wc -l
 mysql -ss -e \
 "SELECT 'dspam (spam learned):   ', sum( spam_learned ) \
 FROM dspam_stats AS s, dspam_virtual_uids AS u \
 WHERE s.uid = u.uid AND u.username != 'dspam'; \
 SELECT 'dspam (spam classified):', sum( spam_classified ) \
 FROM dspam_stats AS s, dspam_virtual_uids AS u \
 WHERE s.uid = u.uid AND u.username != 'dspam';"
 echo
 echo "For the last seven days only..."
 echo -n "vpopmail (user not found):\t"
 zgrep "vchkpw-smtp.*user not found" /var/log/syslog* | wc -l
 echo -n "vpopmail (password fail):\t"
 zgrep "vchkpw-smtp.*password fail" /var/log/syslog* | wc -l

(Am besten gleich noch ein „chmod 700 /usr/local/sbin/qmail-smtpd-log-stats.sh“ hinterher!)

Beispielausgabe

 mail:/# qmail-smtpd-log-stats.sh 
 ripmime (ATTACH):		1
 spamassassin (SPAM):		118
 clamav (VIRUS):		3
 tcpserver (No Reverse DNS):	130
 rblsmtpd (cbl.abuseat.org):	1
 rblsmtpd (www.sorbs.net):	49
 dspam (spam learned):   	0
 dspam (spam classified):	0
 For the last seven days only...
 vpopmail (user not found):	9006
 vpopmail (password fail):	2