Pages

Tuesday, April 10, 2012

Sender Domain Restriction for Postfix Users

Sometimes we flooded with huge spam mails changing the sender address. So it is very important for a administrator to stop the option for local users. Through the following process we will accept mails from the allowed domain names as from address domain.



Step 1:
Add the following line in "main.cf"
smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/mydomains, reject_unauth_destination

Save and Exit


Step 2: 
Create a file in postfix directory. 
vim /etc/postfix/mydomains 

mydomain1.com       OK 
mydomain2.com       OK

 Save and exit.


Step 3:

postmap the file.

postmap /etc/postfix/mydomains


Step 4:

Restart the service.

/etc/init.d/postfix restart


Now users@mydomain1.com / users@mydomain2.com can send mails using this MX.