spam block on Postfix

投稿日:

Postfix で 送信ホスト名からSPAMをblockする。

1. blockしたいホスト名リストの作成

sudo vi /etc/postfix/reject_sender
---
flipmailer.com  REJECT
infoaxe.net     REJECT
---

postfix用にコンパイル。

sudo postmap  /etc/postfix/reject_sender

2. postfix main.cf 書き換え

sudo vi /etc/postfix/main.cf
---
# add for spam 2015/06/30
smtpd_sender_restrictions=check_sender_access hash:/etc/postfix/reject_sender, reject_unknown_sender_domain, reject_non_fqdn_sender
---

3. postfix serverのrestart

sudo /etc/init.d/postfix restart

4. reject logの確認

tail -f /var/log/mail.log
---
Jul  2 09:14:01 ip-100-100-100-249 postfix/smtpd[18230]: connect from mail8.flipmailer.com[74.86.42.168]
Jul  2 09:14:02 ip-100-100-100-249 postfix/smtpd[18230]: NOQUEUE: reject: RCPT from mail8.flipmailer.com[74.86.42.168]: 554 5.7.1 : Sender address rejected: Access denied; from= to= proto=ESMTP helo=
Jul  2 09:14:02 ip-100-100-100-249 postfix/smtpd[18230]: disconnect from mail8.flipmailer.com[74.86.42.168]
---