How to restrict a user to send mail locally only
Sometimes, we need to restrict a specific person to send mail inside your organization only. He will not be able to send mail outer domain except your allowed domain but S/He can receive mail from anywhere.
To implement this restriction, we have to configure the restriction which is given below:
Step:1
Specify the account for which the restriction is applied.
echo "test@example.com restrict_sender" > /opt/zimbra/postfix/conf/restrict_senders 
Note: If you would like to restrict all users of a domain, enter the domain name instead of email ids. 
For example:
echo "yourdomain.com restrict_sender" > /opt/zimbra/postfix/conf/restrict_senders  
Step:2
postmap /opt/zimbra/postfix/conf/restrict_senders
Step:3
Create a blank file in which no domain name is specified.
touch /opt/zimbra/postfix/conf/restrict_recipients 
Step: 4
postmap /opt/zimbra/postfix/conf/restrict_recipients 
Step:5
vim /opt/zimbra/conf/zmconfigd.cf 
Find the "SECTION mta DEPENDS amavis", 
and enter the following before the "RESTART mta" line:
========================================================
POSTCONF smtpd_restriction_classes restrict_sender 
POSTCONF restrict_sender FILE postfix_restrict_sender.cf 
========================================================
Step: 6
vim /opt/zimbra/conf/zmconfigd/smtpd_sender_restrictions.cf
Enter the line below at the top of the file
======================================================
check_sender_access lmdb:/opt/zimbra/conf/restrict_senders
======================================================
Step: 7
vim /opt/zimbra/postfix/conf/main.cf 
Enter these two lines
=======================================================
smtpd_restriction_classes = restrict_sender 
restrict_sender = check_recipient_access lmdb:/opt/zimbra/conf/sender_recipients, reject 
=======================================================
Step: 8
cd /opt/zimbra/conf 
echo "check_recipient_access lmdb:/opt/zimbra/conf/sender_recipients, reject" >> postfix_restrict_sender.cf 
Step: 9
zmmtactl restart

Comments
Post a Comment