Install Postgrey on CentOS

Activate dag repository

[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1

install package

root@ns99 ~ # yum install postgrey

edit startup script /etc/init.d/postgrey

#OPTIONS=”–unix=$SOCKET”
OPTIONS=”–whitelist-clients=/etc/postfix/postgrey_whitelist_clients –whitelist
   recipients=/etc/postfix/postgrey_whitelist_recipients –inet=10023 -d –unix=$SOCKET”

startup postgrey when system is bootup

 root@ns99 ~ # chkconfig postgrey on

install filter to postfix /etc/postfix/main.cf

smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination, check_policy_service inet:127.0.0.1:10023

edit white-list as you need /etc/postfix/postgrey_whitelist_clients

Check delay from maillog

cat /var/log/maillog | postgreyreport 

Install SPF to CentOS Postfix

In computingSender Policy Framework (SPF) allows software to identify messages that are or are not authorized to use the domain name in the SMTP HELO and MAIL FROM (Return-Path) commands, based on information published in a sender policy of the domain owner. Forged return paths are common in e-mail spam and result inbackscatter. SPF is defined in RFC 4408. from wikipedia

Install require packages

root@ns99 ~ # yum install perl-Mail-SPF

Get SPF module from http://www.openspf.org/Software Newest at this time is 2.007 and Install SPF module

root@ns99 ~ # wget http://www.openspf.org/blobs/postfix-policyd-spf-perl-2.007.tar.gz root@ns99 ~ # tar zxvf postfix-policyd-spf-perl-2.007.tar.gz root@ns99 ~ # mv postfix-policyd-spf-perl-2.007/postfix-policyd-spf-perl /usr/local/lib.

add following line to /etc/postfix/master.cf

policy  unix  –       n       n       –       0       spawn
  user=nobody argv=/usr/bin/perl /usr/local/lib/policyd-spf-perl

add following line to /etc/postfix/main.cf

smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination, check_policy_service,
check_policy_service unix:private/policy
policy_time_limit = 3600

Add SPF record to your DNS. SPF record can be wizardly made from  http://old.openspf.org/wizard.html?mydomain=example.com&submit=Go%21

spf01   IN TXT “v=spf1 +ip4:xxx.xxx.xxx.xxx/24 ~all”
spf02   IN TXT “v=spf1 +ip4:yyy.yyy.yyy.yyy/24  ~all”
@       IN TXT “v=spf1 include:spf01.example.com include:spf02.example.com ~all”

Install/upgrade to php 5.2.5 on Centos4

1, Get FedoraCore php src rpm
  -> http://ftp.riken.jp/Linux/fedora/releases/9/Fedora/source/SRPMS/
2, Install php 5.2.5.src.rpm, and modify spec

root@ns99 ~# rpm -ivh php-5.2.5-7.fc9.src.rpm
root@ns99 SPECS#cd /usr/src/redhat/SPECS

replace php.spec as provide here. ” it for avoid error on php test step”
Download php.spec here

3, build rpm and install
If any package need for dependency, install before build rpm. 

 root@ns99 SPECS#rpmbuild –bb php.spec
 root@ns99 SPECS#cd ../RPMS/i386/
 root@ns99 i386# rpm -Uvh php-common-5.2.5-7.i386.rpm php-mysql-5.2.5-7.i386.rpm php-debuginfo-5.2.5-7.i386.rpm  php-ncurses-5.2.5-7.i386.rpm php-devel-5.2.5-7.i386.rpm php-odbc-5.2.5-7.i386.rpm php-pdo-5.2.5-7.i386.rpm php-gd-5.2.5-7.i386.rpm php-pgsql-5.2.5-7.i386.rpm php-imap-5.2.5-7.i386.rpm php-snmp-5.2.5-7.i386.rpm php-ldap-5.2.5-7.i386.rpm php-5.2.5-7.i386.rpm php-mbstring-5.2.5-7.i386.rpm php-bcmath-5.2.5-7.i386.rpm php-mcrypt-5.2.5-7.i386.rpm php-xml-5.2.5-7.i386.rpm php-cli-5.2.5-7.i386.rpm php-mhash-5.2.5-7.i386.rpm php-xmlrpc-5.2.5-7.i386.rpm