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

(Block user to send email locally or externally)
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
===<h1>Block user to send email locally or externally</h1>===
+
{{BC|Certified}}
 +
__FORCETOC__
 +
<div class="col-md-12 ibox-content">
 +
=Block user to send email locally or externally=
 
<hr>
 
<hr>
<br>
+
{{KB|{{ZC}}|{{ZCS 8.8}}|||}}
  
<h2>Problem</h2>
 
  
 +
====Problem====
 
How to block users to send email locally or externally.
 
How to block users to send email locally or externally.
  
<h2>Solution:</h2>
 
  
1). Open file ''/opt/zimbra/conf/zmconfigd/smtpd_sender_restrictions.cf'' and add this line at the top
+
====Solution====
  
%%contains VAR:zimbraMtaSmtpdSenderRestrictions check_sender_access lmdb:/opt/zimbra/postfix/conf/restricted_senders%%
+
=====ZCS 8.8.x and Later=====
  
Then execute :
+
'''Step 1:'''
  
zmprov ms `zmhostname` +zimbraMtaSmtpdSenderRestrictions "check_sender_access lmdb:/opt/zimbra/postfix/conf/restricted_senders"
+
Open file '''''/opt/zimbra/conf/zmconfigd/smtpd_sender_restrictions.cf''''' and add the below line at the top.
  
2). Open file ''/opt/zimbra/conf/zmconfigd.cf'' and add those lines before "'''RESTART mta'''". This is example on my system
+
%%contains VAR:zimbraMtaSmtpdSenderRestrictions check_sender_access lmdb:/opt/zimbra/common/conf/restricted_senders%%
 +
 
 +
Then execute:
 +
 
 +
zmprov ms `zmhostname` +zimbraMtaSmtpdSenderRestrictions "check_sender_access lmdb:/opt/zimbra/common/conf/restricted_senders"
 +
 
 +
'''Step 2:'''
 +
 
 +
Open file '''''/opt/zimbra/conf/zmconfigd.cf''''' and add below lines before "RESTART mta".
  
 
  POSTCONF    smtpd_restriction_classes  local_only
 
  POSTCONF    smtpd_restriction_classes  local_only
 
  POSTCONF    local_only  FILE  postfix_check_recipient_access.cf
 
  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
+
'''Note:''' We can find like below
  
  check_recipient_access lmdb:/opt/zimbra/postfix/conf/local_domains, reject
+
<pre>SECTION mta DEPENDS amavis
 +
  -----------
 +
-----------
 +
-----------
 +
RESTART mta</pre>
  
4). Create a file ''/opt/zimbra/postfix/conf/restricted_senders'' and list a user which you want to block. Follow this syntax :
+
'''Step 3:'''
 +
 
 +
Create a file '''''/opt/zimbra/conf/postfix_check_recipient_access.cf''''' and add the following line.
 +
 
 +
check_recipient_access lmdb:/opt/zimbra/common/conf/local_domains, reject
 +
 
 +
'''Step 4:'''
 +
 
 +
Create a file '''''/opt/zimbra/common/conf/restricted_senders''''' and enter the list of users that 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 don't want to send emails inside or outside from this id. Following is the command :
+
'''Step 5:'''
  
touch /opt/zimbra/postfix/conf/local_domains
+
Create an empty file '''''/opt/zimbra/common/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. <br />Following is the command :
  
6). Run following commands
+
touch /opt/zimbra/common/conf/local_domains
  
  postmap /opt/zimbra/postfix/conf/restricted_senders
+
'''Note:''' When we keep this file empty restricted sender can not send self email as well.
  postmap /opt/zimbra/postfix/conf/local_domains
+
 
 +
'''i.e.:''' Allow User/Domain (user@domain.com OK/domain.com OK)
 +
 
 +
'''Step 6:'''
 +
 
 +
Set ownership permissions for created files
 +
 
 +
chown zimbra:zimbra /opt/zimbra/conf/postfix_check_recipient_access.cf
 +
chmod 644 /opt/zimbra/conf/postfix_check_recipient_access.cf
 +
 
 +
chown :zimbra /opt/zimbra/common/conf/restricted_senders
 +
chmod 775 /opt/zimbra/common/conf/restricted_senders
 +
 
 +
chown :zimbra /opt/zimbra/postfix/conf/local_domains
 +
chmod 775 /opt/zimbra/postfix/conf/local_domains
 +
 
 +
'''Step 7:'''
 +
 +
Run the below commands as Zimbra user.
 +
 
 +
  postmap /opt/zimbra/common/conf/restricted_senders
 +
  postmap /opt/zimbra/common/conf/local_domains
 
  zmmtactl stop
 
  zmmtactl stop
 
  zmmtactl start
 
  zmmtactl start
  
 +
{| class="wikitable" style="background-color:#d0f0c0;" cellpadding="10"
 +
|'''Submitted by''':  Navdeep Mathur
 +
|}
  
 
+
{{Article Footer||}}
Submitted by:  Navdeep Mathur
 

Latest revision as of 08:21, 23 May 2020

Block user to send email locally or externally


   KB 23348        Last updated on 2020-05-23  




0.00
(0 votes)


Problem

How to block users to send email locally or externally.


Solution

ZCS 8.8.x and Later

Step 1:

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

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

Then execute:

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

Step 2:

Open file /opt/zimbra/conf/zmconfigd.cf and add below lines before "RESTART mta".

POSTCONF    smtpd_restriction_classes  local_only
POSTCONF    local_only  FILE  postfix_check_recipient_access.cf

Note: We can find like below

SECTION mta DEPENDS amavis
 -----------
 -----------
 -----------
RESTART mta

Step 3:

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

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

Step 4:

Create a file /opt/zimbra/common/conf/restricted_senders and enter the list of users that you want to block. Follow this syntax:

user@yourdomain.com            local_only

Step 5:

Create an empty file /opt/zimbra/common/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/common/conf/local_domains

Note: When we keep this file empty restricted sender can not send self email as well.

i.e.: Allow User/Domain (user@domain.com OK/domain.com OK)

Step 6:

Set ownership permissions for created files

chown zimbra:zimbra /opt/zimbra/conf/postfix_check_recipient_access.cf
chmod 644 /opt/zimbra/conf/postfix_check_recipient_access.cf
chown :zimbra /opt/zimbra/common/conf/restricted_senders
chmod 775 /opt/zimbra/common/conf/restricted_senders
chown :zimbra /opt/zimbra/postfix/conf/local_domains
chmod 775 /opt/zimbra/postfix/conf/local_domains

Step 7:

Run the below commands as Zimbra user.

postmap /opt/zimbra/common/conf/restricted_senders
postmap /opt/zimbra/common/conf/local_domains
zmmtactl stop
zmmtactl start
Submitted by: Navdeep Mathur
Verified Against: Date Created:
Article ID: https://wiki.zimbra.com/index.php?title=Block_user_to_send_email_locally_or_externally Date Modified: 2020-05-23



Try Zimbra

Try Zimbra Collaboration with a 60-day free trial.
Get it now »

Want to get involved?

You can contribute in the Community, Wiki, Code, or development of Zimlets.
Find out more. »

Looking for a Video?

Visit our YouTube channel to get the latest webinars, technology news, product overviews, and so much more.
Go to the YouTube channel »


Jump to: navigation, search