CentOS 8.x Zimbra blacklist or whitelist IPs or domains
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:
- Create file /opt/zimbra/conf/whitelist with (As zimbra user)
- boss@mybigclient.com
- @bank.com
- Edit '/opt/zimbra/conf/amavisd.conf.in' and append at bottom (Before 1;) (As zimbra user)
- read_hash(%whitelist_sender, '/opt/zimbra/conf/whitelist');
- Restart amavisdctl (As zimbra user)
- zmamavisdctl restart
Blacklist domains or email addresses using amavisd
To blacklist domain or email address using amavisd use:
- Create file /opt/zimbra/conf/blacklist with (As zimbra user)
- @public.com
- @example.com
- Edit '/opt/zimbra/conf/amavisd.conf.in' and append at bottom (Before 1;) (As zimbra user)
- read_hash(%blacklist_sender, '/opt/zimbra/conf/blacklist');
- 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
- To whitelist IPs create file named '/opt/zimbra/conf/postfix_rbl_override' with As zimbra user
- 1.2.3.4 OK
- Postmap file using As zimbra user:
- cd /opt/zimbra/conf/
- postmap /opt/zimbra/conf/postfix_rbl_override
- 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
- To blacklist IPs create file named '/opt/zimbra/conf/postfix_blacklist' with As zimbra user
- 1.2.3.4 REJECT
- Postmap file using As zimbra user:
- cd /opt/zimbra/conf/
- postmap /opt/zimbra/conf/postfix_blacklist
- 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