Thursday, December 16, 2010

How to Restrict postfix recipient in zimbra

Restrict postfix recipient in zimbra

This will show how you can modify postfix to restrict who can send to certain address in your domain such as distribution like team@domain.com.

These change will most likely not persist between upgrades!!!

zimbra/conf/postfix_recipient_restrictions.cf. Also permissions on files created in /opt/zimbra/postfix/conf/ will be changed.

  • Create permitted sender list as zimbra user under /opt/zimbra/postfix/conf/
permitted_sender List :- This file contains domains list OR User mail list, Only protected senders can send mail to this domains OR users.

# vim /opt/zimbra/postfix/conf/permitted_senders

localhost                         OK
myhost.com                    OK
mydomain.com                OK
username@domain.com   OK
  • Create protected recipient file as zimbra user under /opt/zimbra/postfix/conf/
protected_recipients :- This file contains email address that can only receive from permitted senders

# vim /opt/zimbra/postfix/conf/protected_senders

myteam@domain.com                 permitted_senders_list
protect_users@domain.com         permitted_senders_list

  • Include the important setting to /opt/zimbra/postfix/conf/main.cf
permitted_senders_list=check_senders_access hash:/opt/zimbra/postfix/conf/permitted_senders, reject
smtpd_restriction_classes = permitted_senders_list,local_only



FYI :- The changes in main.cf will not survive after the upgrade of zimbra.
  • Now add the this restriction on the top of all line.
# vim /opt/zimbra/conf/postfix_recipient_restrictions.cf
check_recipient_access hash:/opt/zimbra/postfix/conf/protected_recipients
  • Reload the settings
/opt/zimbra/postfix/sbin/postmap /opt/zimbra/postfix/conf/permitted_senders
/opt/zimbra/postfix/sbin/postmap /opt/zimbra/postfix/conf/protected_recipients
/opt/zimbra/postfix/sbin/postmap /opt/zimbra/postfix/conf/postfix_recipient_restrictions.cf

/opt/zimbra/postfix/sbin/postfix  reload

FYI :- This configuration can also used in normal postfix..



2 comments:

Chetanneo said...

it is not working & showing error when receive mail from permitted sender.

Showing error " warning: unknown smtpd restriction: "permitted_senders_list" "

Caterpillar said...

Hi,

Sorry, I forgot to add this line.

smtpd_restriction_classes = permitted_senders_list,local_only