新サーバPostfixにS25Rスパム対策を導入

S25Rスパム対策は、現メールサーバに導入し高いスパム阻止効果を上げています。

Dovecot+Postfixの新サーバにも導入しました。その覚書です。

上記サイトのPostfixでの設定方法を参考にwhite_list、rejections、helo_restrictions三つのファイルを作成します。

今回white_listは上記サイト様のものがすばらしいので(更新もされているようです)簡単なphpスクリプトで

月一回取り込ませていただく事としました。(感謝!)

以下の簡単なスクリプトをcronで月一回実行させます。

<?php

$url=”http://www.gabacho-net.jp/anti-spam/white-list.txt“;

$white_list=”/home/****/white_list”; ユーザーディレクトリの適当な場所に保存

$read=@fopen($url,”r”);

$write=@fopen($white_list,”w”);

while($line=@fgets($read,1024)){

fputs($write_fp,$line);

}

fclose($read);

fclose($write);

?>

ユーザーディレクトリに保存したwhite_listを/etc/postfix/white_listへリンク

 /etc/postfix/main.cfに追加設定

heloが必要

smtpd_helo_required = yes

HELO コマンドの送信制限

smtpd_helo_restrictions =
permit_mynetworks,
reject_invalid_hostname,
check_helo_access regexp:/etc/postfix/helo_restrictions

差出人アドレスの制限

smtpd_sender_restrictions =
permit_mynetworks,
reject_non_fqdn_sender,

reject_unknown_sender_domain

ホワイトリストは許可

smtpd_client_restrictions =
permit_mynetworks,
check_client_access regexp:/etc/postfix/white_list,
check_client_access regexp:/etc/postfix/rejections

以上で設定完了です。

拒絶ログソーティングスクリプト も大変便利なので使用します。

次はいよいよDKIMproxyです。前回大変だったので心配です。