CentOS 8.x Zimbra blacklist or whitelist IPs or domains

From Notes_Wiki

Home > CentOS > CentOS 8.x > CentOS 8.x email servers > CentOS 8.x Zimbra > CentOS 8.x Zimbra blacklist or whitelist IPs or domains

Using spamassassin for blacklist or whitelist of domains or email addresses

It is possible to update SpamAssassin configuration at '/opt/zimbra/conf/salocal.cf.in' and create whitelist or blacklist of domains or emails using:

Whitelist domains or emails

If the address specified is present in any headers ( From , Envelope-Sender , Resent-Sender , or X-Envelope-From ) then the spam score is reduced by 100:

whitelist_from boss@mybigclient.com 
whitelist_from *@bank.com


Whitelist domains or emails validating last server from which they were received

This directive associates a sender's email address with the hostname or domain name of the last trusted relay. SpamAssassin uses DNS to do a reverse-lookup of the IP address of the last trusted relay; the reverse-lookup yields one or more hostnames associated with the IP address. If the last trusted relay reverse lookup matches specified domain then the spam score is reduced by 100.

 whitelist_from_rcvd boss@mybigclient.com mybigclient.com 


Whitelisting recipients

If you want to whitelist recipients (Any email sent to these IDs should not be checked for SPAM) instead of sender there are three options:

whitelist_to
lower spam score by 6
more_spam_to
lower spam score by 20
and all_spam_to
lower spam score by 100

For example

all_spam_to root@* 
all_spam_to postmaster@* 


Blacklist domains or emails

To blacklist domain or address using any of the from fields ( From , Envelope-Sender , Resent-Sender , or X-Envelope-From) and increases SPAM score by 100 use:

blacklist_from *@public.com 
blacklist_from example.com *.example.com 


Refer:


Using amavisd for blacklisting or whitelisting domains

We can use amavisd for blacklisting or whitelistind domains or email addresses using:

Whitelist domains or email addresses using amavisd

To whitelist domain or email address using amavisd use:

  1. Create file /opt/zimbra/conf/whitelist with (As zimbra user)
    boss@mybigclient.com
    @bank.com
  2. Edit '/opt/zimbra/conf/amavisd.conf.in' and append at bottom (Before 1;) (As zimbra user)
    read_hash(%whitelist_sender, '/opt/zimbra/conf/whitelist');
  3. Restart amavisdctl (As zimbra user)
    zmamavisdctl restart


Blacklist domains or email addresses using amavisd

To blacklist domain or email address using amavisd use:

  1. Create file /opt/zimbra/conf/blacklist with (As zimbra user)
    @public.com
    @example.com
  2. Edit '/opt/zimbra/conf/amavisd.conf.in' and append at bottom (Before 1;) (As zimbra user)
    read_hash(%blacklist_sender, '/opt/zimbra/conf/blacklist');
  3. Restart amavisdctl (As zimbra user)
    zmamavisdctl restart


Refer:


Using postfix to whitelist or blacklist IP addresses

Note that while spamassasin works with domains and email addresses, postfix (MTA) can work on whitelisting and blacklisting based on IP addresses.

Whitelist IPs using postfix

  1. To whitelist IPs create file named '/opt/zimbra/conf/postfix_rbl_override' with As zimbra user
    1.2.3.4 OK
  2. Postmap file using As zimbra user:
    cd /opt/zimbra/conf/
    postmap /opt/zimbra/conf/postfix_rbl_override
  3. Add the check for above file to whitelist using: (To be executed only once as Zimbra user)
    zmprov mcf +zimbraMtaRestriction 'check_client_access lmdb:/opt/zimbra/conf/postfix_rbl_override'


Blacklist IPs using postfix

  1. To blacklist IPs create file named '/opt/zimbra/conf/postfix_blacklist' with As zimbra user
    1.2.3.4 REJECT
  2. Postmap file using As zimbra user:
    cd /opt/zimbra/conf/
    postmap /opt/zimbra/conf/postfix_blacklist
  3. Add the check for above file to whitelist using: (To be executed only once as Zimbra user)
    zmprov mcf +zimbraMtaRestriction 'check_client_access lmdb:/opt/zimbra/conf/postfix_blacklist'



Refer:



Home > CentOS > CentOS 8.x > CentOS 8.x email servers > CentOS 8.x Zimbra > CentOS 8.x Zimbra blacklist or whitelist IPs or domains