Feb '09 08

Postgrey and SPF

Installed Postgrey and SPF at home, from etch backports

apt-get install -t etch-backports postfix-policyd-spf-python python-spf
add to main.cf
"check_policy_service unix:private/policy-spf,  check_policy_service inet:127.0.0.1:60000" to smtpd_recipient_restrictions
add to master.cf
policy-spf unix - n n - - spawn
user=nobody argv=/usr/bin/policyd-spf

I’m also looking at plotting the postgrey results into an rrd database, not sure on the exact schema required for what i want to do, but here is a start

rrdtool create postgreystats.rrd --step=86400 DS:failed:ABSOLUTE:86400:0:1000000 RRA:AVERAGE:0.5:1:1095 RRA:MAX:0.5:1:1095 RRA:AVERAGE:0.5:30:36

#!/bin/bash
# Yesterday Only
YESTERDAY=”`date –date=yesterday | cut -b5-10`”
LASTNIGHT=”`date +’%s’ –date=’today 00:00:00’`”

echo -n “PostGrey: ”
FAILED=`grep “$YESTERDAY” /var/log/mail.log | postgreyreport | wc -l`
echo “$FAILED”

rrdtool update /var/spool/postgreystats/postgreystats.rrd $LASTNIGHT:$FAILED

Create a graph with the following, but te number input is 23675 however graph shows 42?
rrdtool graph postgrey.png DEF:failMAX=/var/spool/postgreystats/postgreystats.rrd:failed:MAX LINE1:failMAX#FF0000:"Postgrey failed to return" --start -1d