Whitelist & Blacklist Zimbra Amavis Spam filtering

Whitelist | Blacklist a domain or email address on Zimbra Amavis

Create two files that will store the domains and email addresses you wish to whitelist or blacklist.

$ sudo touch /opt/zimbra/conf/{whitelist,blacklist}
$ sudo chown zimbra:zimbra /opt/zimbra/conf/whitelist
$ sudo chown zimbra:zimbra /opt/zimbra/conf/blacklist
$ sudo vi /opt/zimbra/conf/whitelist
[email protected] contoh.id

$ sudo vi /opt/zimbra/conf/blacklist
[email protected]

Now you need to modify your /opt/zimbra/conf/amavisd.conf.in configuration file have checks on the two files we just added above.

read_hash(%whitelist_sender, '/opt/zimbra/conf/whitelist');
read_hash(%blacklist_sender, '/opt/zimbra/conf/blacklist');

After saving the changes, restart the amavis service.

sudo su - zimbra -c "zmamavisdctl restart"

Whitelist certain IP ranges on Zimbra Amavis

Assuming you trust a network e.g an internal network and would like to bypass checks for these networks, you can configure this on Amavis. First, you need to enable bypass feature which is disabled by default.

$ sudo su - zimbra 
$ zmprov mcf zimbraAmavisOriginatingBypassSA TRUE

When it has been enabled, restart the following services related to Amavis.

$ zmantispamctl restart
$ zmantivirusctl restart
$ zmamavisdctl restart

Check the setting for the current list of trusted networks

$ sudo su - zimbra
$ postconf mynetworks
$ zmprov gs `zmhostname` zimbraMtaMyNetworks

To update a list of trusted MTA networks, use the commands:

$ sudo su - zimbra 
$ zmprov ms `zmhostname` zimbraMtaMyNetworks ''

A point to note is that zmconfigd will automatically restart the MTA processes after this change is made. The zimbraMtaMyNetworks configuration is then included in Amavis in @mynetworks, which causes those IPs to be white-listed.


source : https://computingforgeeks.com/configure-whitelist-blacklist-zimbra-amavis-spam-filtering/