How to block top level domain(TLD) in Zimbra
How to block top level domain(TLD) in Zimbra?
Steps
1. Create a “postfix_reject_sender.re.in” file and add the TLD to block.
$ vim /opt/zimbra/common/conf/postfix_reject_sender.re.in /\.icu$/ REJECT /\.site$/ REJECT /\.host$/ REJECT /\.fun$/ REJECT
Save the file.
2. Now take the backup of zmconfigd.cf file before adding new line.
$ cp /opt/zimbra/conf/zmconfigd.cf /opt/zimbra/conf/zmconfigd.cf.org
Open “/opt/zimbra/conf/zmconfigd.cf” file and go to the MTA section or search “SECTION mta DEPENDS amavis”.
Add following line as per the screenshot:
$ vim /opt/zimbra/conf/zmconfigd.cf
REWRITE common/conf/postfix_reject_sender.re.in common/conf/postfix_reject_sender.re
Save the file.
3.Open the file “/opt/zimbra/conf/zmconfigd/smtpd_sender_restrictions.cf” and add the following line as per screenshot.
$ cp /opt/zimbra/conf/zmconfigd/smtpd_sender_restrictions.cf /opt/zimbra/conf/zmconfigd/smtpd_sender_restrictions.cf.org $ vim /opt/zimbra/conf/zmconfigd/smtpd_sender_restrictions.cf
%%contains VAR:zimbraServiceEnabled mta^ check_sender_access regexp:/opt/zimbra/common/conf/postfix_reject_sender.re%%
4. Now restart the MTA service.
$ zmmtactl restart $ postconf -n | grep -i smtpd_sender_restrictions
The file path "regexp:/opt/zimbra/common/conf/postfix_reject_sender.re" should be there.
Now check and verify.
Note: This is the Postfix level customization, which is not supported by Zimbra and it will not remain same after an upgrade the server. Please follow the above steps in test environment first then apply on production.