IP Address whitelisting

The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

IP Address whitelisting

   KB 2236        Last updated on 2015-07-12  

(0 votes)

Warning, this page is out of date, and contains extremely invalid and incorrect information even for releases where it was once valid.

At times, you may want to bypass or whitelist certain IP ranges, either because they are known to be trusted and internal, or because they provide specific services that should not be checked for spam. It is very important that you don't whitelist an MTA that sends untrusted email, though, for example an inbound MTA (from the Internet) that has not already been checked for spam will then allow all email to arrive unchecked.

Bypassing Internal Networks


In 8.0 (IronMaiden) and later, there is a feature in ZCS to automatically bypass SpamAssassin for mail originating from all IPs within the postfix "mynetworks" IP ranges:

Bypass SA for emails sent from internal ZWC users (or provide a way to score them) [1] - Fixed: 8.0

By default, this bypass is not enabled:


$ zmlocalconfig amavis_originating_bypass_sa
amavis_originating_bypass_sa = false

In order to enable, set to true and restart the MTA processes:

$ zmlocalconfig -e amavis_originating_bypass_sa=true
$ zmamavisdctl restart

Once set, amavis bypasses SpamAssassin for all messages originating internal trusted networks. These networks are configured by modifying the global or server configuration attribute zimbraMtaMyNetworks:

<attr id="311" name="zimbraMtaMyNetworks" type="astring" max="10240" cardinality="multi" optionalIn="globalConfig,server" flags="serverInherited" requiresRestart="mta">
  <desc>value of postfix mynetworks</desc>

Retrieve current settings:

$ zmprov gcf zimbraMtaMyNetworks
$ zmprov gs `zmhostname` zimbraMtaMyNetworks

Configure MTA networks:

$ zmprov ms `zmhostname` zimbraMtaMyNetworks ''
(note: zmconfigd will automatically restart the MTA processes after this change is made).

The zimbraMtaMyNetworks configuration is then included in Amavis in @mynetworks, according to this entry in amavisd.conf, which causes those IPs to be white-listed:

$policy_bank{'ORIGINATING'} = {  # mail supposedly originating from our users
  bypass_spam_checks_maps   => [1], # don't spam-check internal mail

Manual Whitelisting

This shows how to disable anti-spam checking of all emails coming from an IP address -- in other words whitelist an IP address instead of conventional domain name whitelisting.

Everything here is done as the zimbra user. Let's say you want to whitelist all the emails coming from


Enter following line at the top of: /opt/zimbra/conf/postfix_recipient_restrictions.cf

check_client_access hash:/opt/zimbra/postfix/conf/amavis_client_whitelist


Create a file: /opt/zimbra/postfix/conf/amavis_client_whitelist

vi /opt/zimbra/postfix/conf/amavis_client_whitelist FILTER smtp-amavis:[]:10026

Converting amavis_client_whitelist an ASCII form file into maptype database file:

/opt/zimbra/postfix/sbin/postmap /opt/zimbra/postfix/conf/amavis_client_whitelist

That will create a Berkeley DB:

zimbra@zimbra:~$ file /opt/zimbra/postfix/conf/amavis_client_whitelist.db
/opt/zimbra/postfix/conf/amavis_client_whitelist.db: Berkeley DB (Hash, version 8, native byte-order)


Enter following in /opt/zimbra/conf/amavisd.conf.in:

NOTE: Make sure you use the amavisd.conf.in and NOT amavisd.conf

NOTE: If you paste this section in directly, you will need to comment out the existing $inet_socket_port paramater

 $inet_socket_port = [10024, 10026];                     # change from original setting
 $interface_policy{'10026'} = 'CLIENTWHITELIST';              
 $policy_bank{'CLIENTWHITELIST'} = {                          
   bypass_spam_checks_maps   => [1],                          
   final_spam_destiny   => D_PASS,                      

if you want to bypass virus checking too:

 $policy_bank{'CLIENTWHITELIST'} = {                          
   bypass_spam_checks_maps   => [1],                          
   final_virus_destiny => D_PASS,
   final_spam_destiny   => D_PASS,                      


Restart postfix and amavisd

 zmmtactl restart && zmamavisdctl restart
Verified Against: Zimbra Collaboration 7.0, 6.0 Date Created: 04/16/2014
Article ID: https://wiki.zimbra.com/index.php?title=IP_Address_whitelisting Date Modified: 2015-07-12

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