Introduction
The following guide explains the process of configuring Exim to skip spam checks for specific email accounts.
This is especially useful if there is an email address that you and your users forward spam messages to for further analysis e.g. spam@example.tld . Without this customization, it is possible that the message that you forward could be checked by Exim and then denied from being sent or delivered due to the spam or malware check.
At the end of this guide, any message that is sent to any address located within the /etc/spam_analyzers file will not be checked for spam or malware. This applies to incoming and outgoing messages, as well as locally and remotely hosted recipient email addresses.
Please keep in mind that any email address that you specify in that file could potentially receive a very large amount of spam.
Please keep in mind that the process outlined here involves custom configuration that is not a part of the base configuration that cPanel provides. cPanel support can help you understand how to use our features, but cPanel support is not able to provide assistance with creating and maintaining custom configurations. This guide is provided as a courtesy only. If the instructions in this guide do not exactly meet your needs, you must reach out to a systems administrator with the skills, training, and expertise required to craft a custom configuration that meets your specific needs.
Procedure
1. Access SSH or Terminal as the root user
2. Use the following command to create the spam analyzers configuration file:
touch /etc/spam_analyzers
3. Open the file with a text editor and add a list of email addresses that should be able to receive messages that contain spam and malware for further analysis. Each email address should be on a new line. The * wildcard can be used. For example, if you were to add the following line to the file, any message that is destined for an address that has "spam" as the local part of the address will not be scanned for spam or malware:
spam@*
If you were to add the following lines instead, only messages that are sent to exactly these two email addresses will skip spam and malware checks:
spamchecker@myexampledomain.tld
johndoe@anotherexampledomain.tld
4. Create another file with the following commands:
touch /var/log/exim_skip_attachment_checking.log
chown cpaneleximfilter:cpaneleximfilter /var/log/exim_skip_attachment_checking.log
5. Append the following filter configuration to the very top of:
/usr/local/cpanel/etc/exim/sysfilter/options/attachments
if $acl_m_skip_spam_check is 1
then
logfile /var/log/exim_skip_attachment_checking.log
logwrite "$tod_log $message_id Attachment checking has been skipped because the recipient has been designated for the purpose of spam analysis in /etc/spam_analyzers"
finish
endif
There is no need to rebuild the Exim configuration to include this new edit yet. The configuration will automatically be rebuilt on step 13 to include this filter modification. Please do not make any other modifications to the other portions of the filter file other than to append this to the top above all of the other filter rules.
6. Login to WHM as the root user
7. Navigate to: Home »Service Configuration »Exim Configuration Manager
8. Scroll down to the big blue button labeled "Add Additional Configuration Setting" and click on it. Two new text boxes will appear.
9. In the new text box on the left enter the following:
addresslist spam_analyzers
10. In the new text box on the right enter the following:
/etc/spam_analyzers
11. Copy the following configuration:
warn
condition = ${if forany{<, $recipients} {match_address{$item}{+spam_analyzers}}{yes}{no}}
set acl_m_skip_spam_check = 1
log_message = "This message has skipped spam and malware checks because the recipient address has been designated for the purpose of spam analysis in /etc/spam_analyzers"
add_header = X-Spam-Status: Skipped Spam Checking
accept condition = $acl_m_skip_spam_check
12. Ensure a blue checkmark exists next to each of the following sections, and paste the above configuration into the textbox:
- custom_begin_outgoing_notsmtp_checkall
- custom_begin_exiscanall
- custom_begin_spam_scan_check
13. Scroll to the bottom of the page and click the blue Save button
Now you may try sending a test message to one of the email addresses that you have specified in the /etc/spam_analyzers file. After you send the message you may review the log in /etc/exim_mainlog and look for the log message that indicates that spam checking was skipped. If you find that log in place it means that spam checking was skipped for that message.
Comments
0 comments
Article is closed for comments.