Opened 4 years ago

Closed 4 years ago

#8608 closed Question/How do I...? (fixed)

SPAM filter for Roundcube inbox

Reported by: https://id.mayfirst.org/marcy.gelb Owned by: https://id.mayfirst.org/srevilak
Priority: Medium Component: Tech
Keywords: roundcube spam filters Cc:
Sensitive: no

Description

Hello-

A colleague of mine, who no longer uses Outlook to categorize their email, relies solely on Roundcube for email access and wanted to know if there was a way for the inbox to automatically exclude anything that is labeled SPAM. Any feedback would be appreciated.

Thanks-

Al Vega al.vega@…

Change History (12)

comment:1 Changed 4 years ago by https://id.mayfirst.org/dskallman

  • Keywords roundcube spam filters added
  • Owner set to https://id.mayfirst.org/srevilak
  • Status changed from new to assigned

Hi Al,

Thanks for your question. I just logged into my email using Roundcube & the only option I see as of now is junk. So adding messages within the Junk directory should work. But I am not sure that automates it. I think we need to use filters for that.

I'm looping Steve in to help us dig in a bit more here. Steve, can we filter messages to go to spam in Roundcube now? I can't seem to find the way to do that. Can you point us in the the right direction with this?

Thanks,

Dana

comment:2 Changed 4 years ago by https://id.mayfirst.org/srevilak

Hello Dana and Al,

That's a good question. I'm not sure what kind of filtering roundcube supports. Let me do a little research.

Steve

comment:3 Changed 4 years ago by https://id.mayfirst.org/srevilak

Here are some notes from my preliminary investigation.

The roundcube folks have a list of plugins at http://trac.roundcube.net/wiki/Plugin_Repository. Several of these support mail filtering, but most do it through sieve. From what I've read, Courier IMAP (our IMAP Server) doesn't support Sieve, and there are no future plans to do so.

Dovecot supports sieve; there are longer term plans for a courier -> dovecot transition (See ticket #7888), but that transition is likely to take some time.

http://sourceforge.net/projects/rcubefilters/ may work in the interim. It performs filtering on the client side, and perhaps that's enough to take messages with X-Spam-Flag: YES and move them into a separate folder.

I'll try installing rcubefilters on roundcube.dev.mayfirst.org, and see how well it works.

comment:4 Changed 4 years ago by https://id.mayfirst.org/srevilak

Let's put the filter on a branch.

Current deployment in roundcube.dev (from tag roundcube-v1.0-rc-mfpl1).

0 roundcube-code@stallman:/srv/roundcube-dev$ git branch -v | head -1
* (no branch) 643a027 (fetch_identity_objects): avoid redundant call to unserialize
0 roundcube-code@stallman:/srv/roundcube-dev$ git tag --contains 643a027
roundcube-v1.0-rc-mfpl1
0 roundcube-code@stallman:/srv/roundcube-dev$

New branch:

0 roundcube-code@stallman:/srv/roundcube-dev$ git checkout -b filter-test
Switched to a new branch 'filter-test'

Install plugin:

0 roundcube-code@stallman:/srv/roundcube-dev/plugins$ unzip ~/filters-2.1.1.zip Archive:  /home/roundcube-code/filters-2.1.1.zip
   creating: filters/
  inflating: filters/filters.js      
  inflating: filters/filters.php     
   creating: filters/localization/
  inflating: filters/localization/cs_CZ.inc  
  inflating: filters/localization/de_DE.inc  
  inflating: filters/localization/en_US.inc  
  inflating: filters/localization/es_ES.inc  
  inflating: filters/localization/fr_FR.inc  
  inflating: filters/localization/it_IT.inc  
  inflating: filters/localization/nl_NL.inc  
  inflating: filters/localization/pl_PL.inc  
  inflating: filters/localization/pt_PT.inc  
  inflating: filters/localization/ro_RO.inc  
  inflating: filters/localization/ru_RU.inc  
  inflating: filters/localization/sk_SK.inc  
  inflating: filters/localization/zh_TW.inc  
  inflating: filters/README.txt      
0 roundcube-code@stallman:/srv/roundcube-dev/plugins$


0 roundcube-code@stallman:/srv/roundcube-dev/config$ git add ../plugins/filters/
0 roundcube-code@stallman:/srv/roundcube-dev/config$ git commit -m "addition of filters plugin"

Add filters to $config['plugins'] in config.inc.php.

And make small change to plugins/filters/filters.php.

-    $this->spam_subject = '[SPAM]';
+    $this->spam_subject = '***SPAM***';

I probably have to tune this rule: I don't recall how many *'s we add to the subject line, and I don't have a piece of spam handy.

Preliminary test was okay: I sent a faux spam message to myself, and filters moved it into a folder called "Junk".

Will try again when I get some real spam.

comment:5 Changed 4 years ago by https://id.mayfirst.org/srevilak

I tested the "filters" plugin with some real spam.

First, edited plugins/filters/filter.php, setting

   $this->spam_subject = '*****SPAM*****';

which matches what we put in the subject line.

Second, deleted the "Junk" folder, which is where filters moves spam.

Third, logged into roundcube.dev. Verified that filters moved the spam messages into the Junk folder.

So far, filters seems to work alright.

comment:6 Changed 4 years ago by https://id.mayfirst.org/dkg

My only concern is that the "right way" to do this is to do filtering at message delivery time, not at webmail login time. doing this at message delivery time in a sensible and compatible way would probably mean using sieve (#6202), but we don't have tools in place for that. Putting this filter in place now might complicate the transition to sieve when we do get it. However, #1481 suggests a way to drop a .mailfilter rule into a user's home directory that would do this at delivery time.

If the only plan is to filter spam into a separate mailbox, perhaps we could just provide a simple way for users to do that (e.g. in red?) and place a link in roundcube to let them make this configuration change.

if several members have a large queue of unread messages and a set of rules, iterating over them at roundcube login to do arbitrary check seems like it would be expensive on the roundcube frontend and on the imap daemons, which might have performance impacts on all the rest of the membership's use of webmail, though i haven't done any work to quantify this concern.

comment:7 Changed 4 years ago by https://id.mayfirst.org/srevilak

My only concern is that the "right way" to do this is to do filtering at message delivery time, not at webmail login time.

I agree; filtering at delivery time is the preferable long-term solution.

Putting this filter in place now might complicate the transition to sieve when we do get it.

That's probably true too.

However, #1481 suggests a way to drop a .mailfilter rule into a user's home directory that would do this at delivery time.

There's a lot of useful information in that ticket, and the "spam" maildrop recipie in #1481 would definitely get the job done.

According to http://wiki2.dovecot.org/Pigeonhole/Sieve/Configuration, dovecot sieve looks for rules in ~/.dovecot.sieve; in the worst case, it should simply ignore a ~/.mailfilter file.

I'll back out the "filters" plugin from roundcube.dev.mayfirst.org.

comment:8 Changed 4 years ago by https://id.mayfirst.org/srevilak

  • Resolution set to fixed
  • Status changed from assigned to feedback

Al: we have a longer-term plan to get a better mail filtering system in place, and I think that waiting for the long-term improvement may be a better choice than doing an interim fix.

I'll suggest using the ideas from #1481 for now, but please let me know if you need help setting them up.

comment:9 Changed 4 years ago by https://id.mayfirst.org/marcy.gelb

  • Resolution fixed deleted
  • Status changed from feedback to assigned

I just created a ticket about this again and forgot I had brought this up 1 month ago. I see there were responses. Not sure I understand everything but sounded like there might be a temporary solution.

Can I get some assistance to attempt what is mentioned in #1481 so we can at least see if it is possible to reduce the SPAM in the inbox?

I am not sure what steps I need to take in order for this to work. Please advise.

Thanks-

Al

comment:10 Changed 4 years ago by https://id.mayfirst.org/srevilak

Al,

You'll want to create a file called ".mailfilter", containing the following

logfile "$HOME/mailfilter.log"
MAILBOX="$HOME/Maildir/"
# get rid of spam
if (/^X-Spam-Flag: YES/)
{
        to "Maildir/.Junk/"
}

Then upload this file to the primary server in your hosting order (I believe that would be chavez.mayfirst.org).

Once you've done this, newly-delivered spam will be filed in a folder called "Junk". (However, *****SPAM***** that's already in your inbox will remain there).

Let me know how it goes.

comment:11 Changed 4 years ago by https://id.mayfirst.org/srevilak

  • Resolution set to fixed
  • Status changed from assigned to feedback

Al, did you have any luck with the .mailfilter recipie in comment:10? (I've started using it myself, and it's been working pretty well for me.)

comment:12 Changed 4 years ago by automatic

  • Status changed from feedback to closed

No news is good news (we hope)! Given the lack of feedback, we think this ticket can be closed.

Please login to add comments to this ticket.

Note: See TracTickets for help on using tickets.