Help - Search - Members - Calendar
Full Version: SPAM moved into subfolder
RV Products Forums > Server-Wide Spam and Virus Protection > General
jonasplus
Hi guys,

These scripts & howto are great. Thanks.
Reduced the spamload of my users (and myself) quite considerably.

One thing - I'd like to move spam messages into a subfolder and tag them, NOT only tag them.
Pretty much like the "spambox" in cpanel spamassasin configuration.

Especially for mobile devices this is extremely helpful, then the inbox isn't full with spams, which then saves data when checking the mailbox.

At the moment I'm relying on spamassasin per-domain to re-filter the messages and move them into the subfolder, but that's not a good solution (increases CPU- & memory-load and is sometimes unreliable)

I know that exim is capable of moving messages, but for me it somehow didn't work.

Have any of you done that before?

Or, if not, can you point me in the right direction?

Thanks!
Jonas
jonasplus
idea? anyone?

Exim filters - should be possible to move messages?

Or if you haven't done it yourself, maybe an idea where to find an answer?

Thanks!
pairote
In WHM exim configuration, search localuser_spam. You need to write your own router similar to localuser_spam. Place it on the box below localuser_spam. It will look like this. Use it as your own risk. We didn't test it.

QUOTE
localuser_exisspam:
driver = accept
headers_remove="X-Exiscan-SA-Spam"
condition = ${if eqi{$h_X-Exiscan-SA-Spam:}{yes}{true}{false}}
check_local_user
domains = ! lsearch;/etc/userdomains
transport = local_delivery_spam


You also need to edit system filter file. Find below

QUOTE
##
# Rewrite subject if email scored between 9 and 15.
##
if
"${if def:header_X-Exiscan-SA-New-Subject: {there}}" is "there"
and ("${lookup{${lc:$sender_address}}lsearch*@{/usr/local/cpanel/base/eximacl/rv_spam_sender_address_whitelist}{1}{fail}}" is "fail")
# A message may have many recipients, so many local parts and domains, but
# the system filter is run only once. If the domains are different, all domains MUST listed in the whitelist,
# otherwise email will be rejected.
and foranyaddress ${lc:$recipients}("${lookup{${thisaddress}}lsearch*@{/usr/local/cpanel/base/eximacl/rv_spam_receiver_domain_whitelist}{1}{fail}}" is
"fail")
then
headers remove Subject
headers add "Subject: $h_X-Exiscan-SA-New-Subject:"
headers remove X-Exiscan-SA-New-Subject
endif


And add

QUOTE
.....
headers remove Subject
headers add "Subject: $h_X-Exiscan-SA-New-Subject:"
headers remove X-Exiscan-SA-New-Subject
headers add "X-Exiscan-SA-Spam: Yes"
.....
jonasplus
Hi Pairote,

Thanks for your tip!

I now have the following in the system file /usr/local/cpanel/base/eximacl/antivirusandspam.exim:

QUOTE
##
# Rewrite subject if email scored between 9 and 15.
##
if
"${if def:header_X-Exiscan-SA-New-Subject: {there}}" is "there"
and ("${lookup{${lc:$sender_address}}lsearch*@{/usr/local/cpanel/base/eximacl/rv_spam_sender$
# A message may have many recipients, so many local parts and domains, but
# the system filter is run only once. If the domains are different, all domains MUST listed in t$
# otherwise email will be rejected.
and foranyaddress ${lc:$recipients}("${lookup{${thisaddress}}lsearch*@{/usr/local/cpanel/bas$
then
headers remove Subject
headers add "Subject: $h_X-Exiscan-SA-New-Subject:"
headers remove X-Exiscan-SA-New-Subject
headers add "X-Exiscan-SA-Spam: Yes"
endif


And in the Exim config I added this to the box below
QUOTE
localuser_exisspam:
driver = accept
headers_remove="X-Exiscan-SA-Spam"
condition = ${if eqi{$h_X-Exiscan-SA-Spam:}{yes}{true}{false}}
check_local_user
domains = ! lsearch;/etc/userdomains
transport = local_delivery_spam


Spam gets tagged correctly, but still not delivered into the subfolder. I tested with the spamassin test message.

I now disable the per-domain spam-assasin and the "spambox".
jonasplus
Okay, I figured out a way. Not the cleanest way, but it works.

When enabling spambox in cpanel it creates a file .spamassassinboxenable in the user directory.
I left this file there.

I then changed
QUOTE
then
headers remove Subject
headers add "Subject: $h_X-Exiscan-SA-New-Subject:"
headers remove X-Exiscan-SA-New-Subject
endif


to
QUOTE
$
then
headers remove Subject
headers add "Subject: $h_X-Exiscan-SA-New-Subject:"
headers remove X-Exiscan-SA-New-Subject
headers add "x-spam-exim: Yes"
endif


And that does it for me! Sweet.

It seems to me that the new exim filter in WHM didn't work properly. So I added "headers add "x-spam-exim: Yes" in order to use the cpanel exim filter. And that's working fine. Cool.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.