close

How To Block Domains (Postfix) 

Guys who manage Postfix servers, what do you recommend is the best way to refuse all incoming and outgoing mail to specific domains? I want a blacklist of domains such as:

 - AOL
 - Yahoo
 - MSN
 - Hotmail
 - Gmail

 Is there a proper way I can tell Postfix to please deny sending and receiving SMTP traffic to and from those specific domains I specify? I see no need in my corp. mail server has to communicate in any way to those. I allow access to all those accounts via port 80/443 so they can just login to the web and send non business related junk this way.

 Anyone know a preferred way to accomplish this in Postfix?

network answer

So, if you are sure you want to block all mail to/from the list of domains, you can add the following directive to your postfix main.cf file:

Code:
smtpd_sender_restrictions = hash:/etc/postfix/access
reject_unauth_destination = hash:/etc/postfix/access
Once this has been added to the main.cf, you need to create the /etc/postfix/access file and put entries in it like this:

Code:
aol.com     REJECT
yahoo.com   REJECT
msn.com     REJECT
So on and so forth until all the domains have been entered. Once you have created this file and the permissions are correct run the following command:

Code:
postmap hash:/etc/mail/access
and finally restart postfix.

 This will prevent the offending domains from sending you mail and your users from sending mail to those domains.

**NOTE**I have used smtpd_sender_restrictions in past configurations, I have not used reject_unauth_destination, and based that portion of this reply on what I read on the postfix site. You may want to impliment each one seperately and test.
 

arrow
arrow
    創作者介紹
    創作者 Johnson峰 的頭像
    Johnson峰

    Johnson峰的部落格

    Johnson峰 發表在 痞客邦 留言(0) 人氣()