My Postgrey Installation:
[Back]
I run Postfix, Amavisd, Spamassassin and ClamAV on I386 machines
with Fedora Core 4 though 8 OS)
(These instructions may be more than needed, but it works for me.)
Postgrey Requirements:
Perl >= 5.6.0
Perl Module Net::Server
Perl Module IO::Multiplex
Perl Module BerkeleyDB
perl -MCPAN -e shell
install Net::Server
install IO::Multiplex
install BerkeleyDB
Berkeley DB >= 4.1 (Library)
Download BerkeleyDB to temp directory (/usr/local/src/)
(wget http://freshmeat.net/redir/berkeleydb/694/url_tgz/db-4.5.20.tar.gz)
tar xvfz DB-x.x.x.tar.gz
cd DB-x.x.x
cd build_unix
../dist/configure
make
make install
Postgrey:
Download to temp directory (/usr/local/src/)
tar xvfz postgrey-x.x.tar.gz
cd postgrey-x-x
cp postgrey /usr/sbin/
cp postgrey_whitelist_clients /etc/postfix/
cp postgrey_whitelist_recipients /etc/postfix/
useradd postgrey (this also creates the group on my machine)
vi /etc/passwd
change postgrey user login to /sbin/nologin
mine shows: postgrey:x:12347:12347::/home/postgrey:/sbin/nologin
mkdir /var/spool/postfix/postgrey
chown postgrey:postgrey /var/spool/postfix/postgrey
I found this startup script and modified it to fit my needs:
Place in /etc/init.d/postgrey
#!/bin/bash
#
# postgrey startup script
# chkconfig: 2345 80 30
# description: Postgrey is a greylisting agent for Postfix.
#
case "$1" in
start)
# Start Postgrey
/usr/sbin/postgrey --inet=127.0.0.1:10023 -d --delay=20 \
--greylist-text="Policy restrictions; try later" \
--user=postgrey --group=postgrey
;;
stop)
# Stop Postgrey
killall postgrey
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
;;
esac
chmod u+x,g+x /etc/init.d/postgrey
mkdir /var/run/postgrey/
chown -R postgrey:postgrey /var/run/postgrey/
vi /etc/postfix/main.cf
In smtpd_recipient_restrictions
after reject_unauth_destination and permit_mynetworks, before permit (all) add
check_policy_service inet:127.0.0.1:10023,
Start Postgrey:
/etc/init.d/postgrey start
Set to start at boot:
chkconfig --add postgrey on
LINUX2
This cleans up postfix and restarts the service.
(You may want to reboot the computer to verify that everything loads correctly.)
tail -f /var/log/maillog to check for errors
Email Me Questions or Feedback
Useful Links/Information:
In the install directory, you can run:
perdoc postgrey
Postgrey Homepage:
http://postgrey.schweikert.ch/
http://www.howtoforge.com/forums/showthread.php?t=5178
http://en.wikipedia.org/wiki/Greylisting
http://www.postfix-howto.de/installation/greylisting.htm