Exim Configuration Manager > Custom Filter. Not Working

Jan 17, 2009
16
1
53
Hi all.

I have an issue with the custom filter functionality.

I need to configure some custom filters and I need that these filters not be excluded in futures cpanel updates, then I followed the instrucitions to create custom filter rules here:
How to Customize the Exim System Filter File - cPanel Knowledge Base - cPanel Documentation

I created a file called spamsubject at "/usr/local/cpanel/etc/exim/sysfilter/options/"
Then, in the "WHM > Exim Configuration Manager > Basic Editor > Filters tab" I see at the bottom the "Custom Filter: subjectspam [?] ON (default)".

This little code bellow is working well when I insert directly at "/etc/antivirus.exim", I tested and the filter works fine, but when I put in the "/usr/local/cpanel/etc/exim/sysfilter/options/subjectspam", the filter don't works. I already restart exim all the times.

What could be the problem?

The server is WHM 54.0 (build 21), is this version working well with exim custom filters?

Code:
# test

if
$header_subject: contains "viagra"

then
fail text "Rejected by spam words at subject"

seen finish
endif
Thanks in advance by any help.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,203
363
Hello :)

Could you post the output from /var/log/exim_mainlog for the test message you sent after enabling this system filter rule? EX:

Code:
exigrep [email protected] /var/log/exim_mainlog
Was this test email sent from a remote mail server?

Thank you.
 
Jan 17, 2009
16
1
53
Hello, cPanelMichael :)
Sure, let's go.

Yes, I did the tests from a @gmail.com to local

This is the log when the filter is in /usr/local/cpanel/etc/exim/sysfilter/options/subjectspam
Filter didn't worked. Message arrives in local mail.
Code:
2016-04-25 20:39:52 1auq6Z-003Lh9-Cd H=mail-ob0-f173.google.com [209.85.214.173]:36659 I=[98.142.98.102]:25 Warning: "SpamAssassin as digitalc detected message as NOT spam (-100.0)"

2016-04-25 20:39:52 1auq6Z-003Lh9-Cd <= [email protected] H=mail-ob0-f173.google.com [209.85.214.173]:36659 I=[98.142.98.102]:25 P=esmtps X=TLSv1.2:RC4-SHA:128 CV=no S=4932 [email protected]l.com T="compre viagra" from <[email protected]> for [email protected]
2016-04-25 20:39:52 1auq6Z-003Lh9-Cd => celso <[email protected]> F=<[email protected]> R=virtual_user T=virtual_userdelivery S=5058
2016-04-25 20:39:52 1auq6Z-003Lh9-Cd Completed

And this is the filter in antivirus.exim
Filter worked, same message subject, and the email returned to @gmail with the message error.
Code:
2016-04-25 20:45:26 1auqBw-003M5h-QN H=mail-oi0-f50.google.com [209.85.218.50]:35704 I=[98.142.98.102]:25 Warning: "SpamAssassin as digitalc detected message as NOT spam (-100.0)"
2016-04-25 20:45:26 1auqBw-003M5h-QN <= [email protected] H=mail-oi0-f50.google.com [209.85.218.50]:35704 I=[98.142.98.102]:25 P=esmtps X=TLSv1.2:RC4-SHA:128 CV=no S=4927 [email protected]l.com T="compre viagra" from <[email protected]> for [email protected]
2016-04-25 20:45:26 1auqBw-003M5h-QN cancelled by system filter: Rejected by spam words at subject
2016-04-25 20:45:26 1auqBw-003M5h-QN Completed

Seems the files in /usr/local/cpanel/etc/exim/sysfilter/options/ are not working even the Exim Configuration Manager > Custom Filter are activated.

regards.

 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,203
363
Hello,

I believe the issue is with your filter syntax, as I was unable to reproduce the issue on a test system. Please try updating your custom filter rule to an entry such as this:

Code:
# test

if $header_subject: contains "viagra"
then fail text "Rejected by spam words at subject" endif
Thank you.