Restricting Users from Sending Mails to External Domains

This method is based on command line. We begin this process by modifying the config file called /opt/zimbra/conf/zmconfigd/smtpd_sender_restrictions.cf. Inside this file, we add the following line at the top:

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

Next, let’s modify another config file (/opt/zimbra/conf/zmconfigd.cf), in which we define a class representing users who can only send internal mails. While modifying this file, we need to add following lines withing SECTION mta just before RESTART mta.


POSTCONF smtpd_restriction_classes local_only
POSTCONF local_only FILE postfix_check_recipient_access.cf
[zimbra@mail ~]# vi /opt/zimbra/conf/postfix_check_recipient_access.cf
check_recipient_access lmdb:/opt/zimbra/postfix/conf/local_domains, reject


Now, we need to create two files: one for local users and other for local domains.


[zimbra@mail ~]# vi /opt/zimbra/postfix/conf/restricted_senders
local.user1@sajjan.com.np    local_only
local.user2@sajjan.com.np    local_only
[zimbra@mail ~]# vi /opt/zimbra/postfix/conf/local_domains
sajjan.com.np            OK


Finally, to implement the changes, we need to map the config files to postifx and then restart the MTA service.


[zimbra@mail ~]# postmap /opt/zimbra/postfix/conf/restricted_senders
[zimbra@mail ~]# postmap /opt/zimbra/postfix/conf/local_domains
[zimbra@mail ~]# zmmtactl restart


This completes this blog post. I hope this is useful. Please let me know of your queries or suggestions in the Comment Section below. Thank you for reading!


Ref:

https://blog.sajjan.com.np/2016/08/16/restrict-zimbra-user-send-receive-external-mails/

Comments

Popular posts from this blog

Cambium cnPilot E400/E410/E500 Configuration Tutorial

Disabling Zimbra's AntiSpam, Amavis and AntiVirus filtering

Error "Unable to retrive Zimbra GPG key for package validation"