Difference between revisions of "Block user to send email locally or externally"

(Created page with "===<h1>Block user to send email locally or externally</h1>=== <hr> <br> <h2>Problem</h2> How to block user to send email locally or externally <h2>Solution:</h2> 1. Open f...")
 
Line 5: Line 5:
 
<h2>Problem</h2>
 
<h2>Problem</h2>
  
How to block user to send email locally or externally
+
How to block users to send email locally or externally.
  
 
<h2>Solution:</h2>
 
<h2>Solution:</h2>
  
1. Open file /opt/zimbra/conf/zmconfigd/smtpd_sender_restrictions.cf and add this line at the top
+
1). Open file ''/opt/zimbra/conf/zmconfigd/smtpd_sender_restrictions.cf'' and add this line at the top
  
 
  %%contains VAR:zimbraMtaSmtpdSenderRestrictions check_sender_access lmdb:/opt/zimbra/postfix/conf/restricted_senders%%
 
  %%contains VAR:zimbraMtaSmtpdSenderRestrictions check_sender_access lmdb:/opt/zimbra/postfix/conf/restricted_senders%%
Line 17: Line 17:
 
  zmprov ms `zmhostname` +zimbraMtaSmtpdSenderRestrictions "check_sender_access lmdb:/opt/zimbra/postfix/conf/restricted_senders"
 
  zmprov ms `zmhostname` +zimbraMtaSmtpdSenderRestrictions "check_sender_access lmdb:/opt/zimbra/postfix/conf/restricted_senders"
  
2. Open file /opt/zimbra/conf/zmconfigd.cf and add those lines before RESTART mta. This is example on my system
+
2). Open file ''/opt/zimbra/conf/zmconfigd.cf'' and add those lines before "'''RESTART mta'''". This is example on my system
  
 
  POSTCONF    smtpd_restriction_classes  local_only
 
  POSTCONF    smtpd_restriction_classes  local_only
Line 23: Line 23:
 
  RESTART mta
 
  RESTART mta
  
3. Create a file /opt/zimbra/conf/postfix_check_recipient_access.cf and add the following line
+
3). Create a file ''/opt/zimbra/conf/postfix_check_recipient_access.cf'' and add the following line
  
 
  check_recipient_access lmdb:/opt/zimbra/postfix/conf/local_domains, reject
 
  check_recipient_access lmdb:/opt/zimbra/postfix/conf/local_domains, reject
  
4. Create a file /opt/zimbra/postfix/conf/restricted_senders” and list a user which you want to block. Follow this syntax :
+
4). Create a file ''/opt/zimbra/postfix/conf/restricted_senders'' and list a user which you want to block. Follow this syntax :
  
 
  user@yourdomain.com            local_only
 
  user@yourdomain.com            local_only
  
5. Create an empty file /opt/zimbra/postfix/conf/local_domains”, here we list all the domains where “restricted users” allowed to send mails. But we will keep this blank file as we dont want to send emails inside or outside from this id. Following is the commmand :
+
5). Create an empty file ''/opt/zimbra/postfix/conf/local_domains'', here we list all the domains where '''restricted users''' allowed to send mails. But we will keep this blank file as we don't want to send emails inside or outside from this id. Following is the command :
  
 
  touch /opt/zimbra/postfix/conf/local_domains
 
  touch /opt/zimbra/postfix/conf/local_domains
  
6. Run following commands
+
6). Run following commands
  
 
  postmap /opt/zimbra/postfix/conf/restricted_senders
 
  postmap /opt/zimbra/postfix/conf/restricted_senders
Line 44: Line 44:
  
  
"Navdeep Mathur"
+
Submitted by:  Navdeep Mathur
 
 
<mathurn@zimbra.com>
 

Revision as of 13:10, 20 August 2017

Block user to send email locally or externally



Problem

How to block users to send email locally or externally.

Solution:

1). Open file /opt/zimbra/conf/zmconfigd/smtpd_sender_restrictions.cf and add this line at the top

%%contains VAR:zimbraMtaSmtpdSenderRestrictions check_sender_access lmdb:/opt/zimbra/postfix/conf/restricted_senders%%

Then execute :

zmprov ms `zmhostname` +zimbraMtaSmtpdSenderRestrictions "check_sender_access lmdb:/opt/zimbra/postfix/conf/restricted_senders"

2). Open file /opt/zimbra/conf/zmconfigd.cf and add those lines before "RESTART mta". This is example on my system

POSTCONF    smtpd_restriction_classes  local_only
POSTCONF    local_only  FILE  postfix_check_recipient_access.cf
RESTART mta

3). Create a file /opt/zimbra/conf/postfix_check_recipient_access.cf and add the following line

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

4). Create a file /opt/zimbra/postfix/conf/restricted_senders and list a user which you want to block. Follow this syntax :

user@yourdomain.com            local_only

5). Create an empty file /opt/zimbra/postfix/conf/local_domains, here we list all the domains where restricted users allowed to send mails. But we will keep this blank file as we don't want to send emails inside or outside from this id. Following is the command :

touch /opt/zimbra/postfix/conf/local_domains

6). Run following commands

postmap /opt/zimbra/postfix/conf/restricted_senders
postmap /opt/zimbra/postfix/conf/local_domains
zmmtactl stop
zmmtactl start


Submitted by: Navdeep Mathur

Jump to: navigation, search