Jump to content

Sender recipient restriction in zimbra: Difference between revisions

From TetraWiki
Abhinav (talk | contribs)
Created page with "Category:Zimbra Restrict Recipient In Zimbra This will show how you can modify postfix to restrict who can send and receive to ce..."
 
Abhinav (talk | contribs)
No edit summary
 
Line 128: Line 128:
  postmap /opt/zimbra/postfix/conf/restricted_senders
  postmap /opt/zimbra/postfix/conf/restricted_senders


       postmap /opt/zimbra/postfix/conf/local_domains  
       postmap /opt/zimbra/postfix/conf/local_domains
 
vim  /opt/zimbra/conf/zmconfigd/smtpd_sender_restrictions.cf
check_sender_access hash:/opt/zimbra/postfix/conf/restricted_senders
 
       zmmtactl stop
       zmmtactl stop
       zmmtactl start  
       zmmtactl start  



Latest revision as of 05:18, 19 November 2013


                                    Restrict Recipient In Zimbra



This will show how you can modify postfix to restrict who can send and receive to certain addresses in your domain


Steps


Create a 'permitted senders' list (as user zimbra) - This is your list of domains and/or users who can email your protected email addresses:

vi /opt/zimbra/postfix/conf/permitted_senders
localhost               OK
rockmanindustries.com            OK
zimbramail.rockmanindustries.com     OK


Create a 'protected recipients' list (as user zimbra) - This is your list of email addresses that may only receive email from 'permitted senders'

vi /opt/zimbra/postfix/conf/protected_recipients
test-dist-list@rockmanindustries.com        permitted_senders_list
protected-user@rockmanindustries.com         permitted_senders_list

Create a simple bash script to create postfix DB files (as user zimbra):

vi /opt/zimbra/postfix/conf/update_protected_recipients
#!/bin/bash
echo "rebuild permitted_senders..."
postmap /opt/zimbra/postfix/conf/permitted_senders
echo "rebuild protected_recipients..."
postmap /opt/zimbra/postfix/conf/protected_recipients

Make new script executable,

chmod 755 /opt/zimbra/postfix/conf/update_protected_recipients

then run it...

 /opt/zimbra/postfix/conf/update_protected_recipients

You should now see permitted_senders.db and protected_recipients.db in the directory


� Add necessary settings to /opt/zimbra/postfix/conf/main.cf vi /opt/zimbra/postfix/conf/main.cf

[add these items to the file - note permitted_senders_list must match value in protected_recipients
permitted_senders_list = check_sender_access hash:/opt/zimbra/postfix/conf/permitted_senders, reject
smtpd_restriction_classes = permitted_senders_list
**Note this change to the main.cf won't survive upgrades. Be sure to save a copy of your main.cf file**


While in /opt/zimbra/postfix/conf/main.cf: You must also add the following snippet to smtpd_recipient_restrictions (first is preferred, otherwise anywhere before  the last "permit", THE ORDER IN WHICH ITEMS APPEAR HERE IS IMPORTANT (if it appears after the "permit", mail will always be accepted for the restricted recipient): 
smtpd_recipient_restrictions = check_recipient_access hash:/opt/zimbra/postfix/conf/protected_recipients, (rest of line here)


Now add your new restriction to the top of smtpd_recipient_restrictions.cf

vi /opt/zimbra/conf/zmconfigd/smtpd_recipient_restrictions.cf 
[paste this into the first line of the file, above any other settings] 
check_recipient_access hash:/opt/zimbra/postfix/conf/protected_recipients

Edit /opt/zimbra/conf/zmconfigd.cf and then remove the following line;


# POSTCONF smtpd_recipient_restrictions FILE postfix_recipient_restrictions.cf
postfix reload



Note: Test It on one user that only localdomain mails is deliver to user mailbox    





� Restricting users to send mails to certain domains



Vi /opt/zimbra/conf/zmconfigd/smtpd_recipient_restrictions.cf

check_sender_access hash:/opt/zimbra/postfix/conf/restricted_senders


vi /opt/zimbra/conf/zmconfigd.cf

Find the section labeled SECTION mta and enter the following two lines directly below
POSTCONF    smtpd_restriction_classes      local_only , permitted_sender_list
POSTCONF    local_only                                 FILE  postfix_check_recipient_access.cf

Create a file "/opt/zimbra/conf/postfix_check_recipient_access.cf"

vi /opt/zimbra/conf/postfix_check_recipient_access.cf

check_recipient_access hash:/opt/zimbra/postfix/conf/local_domains, reject

Create a file "/opt/zimbra/postfix/conf/restricted_senders" and list all the users, whom you want to restrict. Follow this syntax:

vi /opt/zimbra/postfix/conf/restricted_senders

     user@rockmanindustries.com            local_only

Create a file "/opt/zimbra/postfix/conf/local_domains" and list all the domains where "restricted users" allowed to sent mails. Please follow this syntax:

vi /opt/zimbra/postfix/conf/local_domains
     rockmanindustries.com                OK 
     otheralloweddomain.com      OK

Run following commands:

postmap /opt/zimbra/postfix/conf/restricted_senders
     postmap /opt/zimbra/postfix/conf/local_domains
vim  /opt/zimbra/conf/zmconfigd/smtpd_sender_restrictions.cf
check_sender_access hash:/opt/zimbra/postfix/conf/restricted_senders 
 
     zmmtactl stop
     zmmtactl start