rpmforgeリポジトリを有効にしておく
# yum --enablerepo=rpmforge install postgrey
# vi /etc/init.d/postgrey
# OPTIONS="--unix=$SOCKET" (コメントアウト)
# vi /etc/sysconfig/postgrey (新規作成)
OPTIONS="--inet=127.0.0.1:10023"
# service postgrey start
# chkconfig postgrey on
# vi /etc/postfix/main.cf
smtpd_client_restrictions =
permit_mynetworks ,
reject_unauth_destination ,
reject_unauth_pipelining ,
# reject_unknown_client , (*1)
# check_client_access regexp:/etc/postfix/client_restrictions,(*2)
# reject_rbl_client sbl-xbl.spamhaus.org ,(*2)
check_policy_service inet:127.0.0.1:10023
# service postfix restart
(*1)…postgreyとは共存不可(意味なし)
(*2)…デバッグ後は有効に。
参照:迷惑メール対策シリーズ/postgrey の導入
# grep 'action=greylist' /var/log/maillog
(これで引っかかるようになったら)
# yum install db4-utils
# cd /var/spool/postfix/postgrey
# db_dump -p postgrey.db(保留中リスト)
# db_dump -p postgrey_clients.db(許可リスト)
IPをclient_restrictionsに記載する(いたちごっこ)
MXが複数ある場合は、拒否されると送信元は次のMXに
送ろうとするので、学習するのに時間がかかる。。。