[Dovecot] Filtering spam in an offlineimap + dovecot setup
Hello,
To easily access my mail both offline on my computer and on my phone, I am synchronizing a local copy on my computer using offlineimap. As the spam filtering options provided on the server are not sufficient, I am now looking into client-side spam filtering.
My current setup is as follows. Mail is synchronized using offlineimap, and delivered to a local dovecot server:
--8<---------------cut here---------------start------------->8--- [Repository LocalIMAP] type = IMAP preauthtunnel = /usr/local/Cellar/dovecot/2.2.10/libexec/dovecot/imap -c ~/.dovecotzimbra.rc --8<---------------cut here---------------end--------------->8---
The configuration of the local server is simply:
--8<---------------cut here---------------start------------->8--- protocols = imap mail_location = maildir:~/.Maildir/zimbra:INBOX=~/.Maildir/zimbra/.INBOX --8<---------------cut here---------------end--------------->8---
I then read my mail using gnus, and index it using notmuch.
A suggestion I've been considering is use the pigeonhole sieve extprograms plugin (http://wiki2.dovecot.org/Pigeonhole/Sieve/Plugins/Extprograms) to call the spam filter (I've been looking at dspam at the moment). However, I could not find how to configure the use of sieves in the context of offlineimap. Hence my questions:
Is it possible to use dovecot sieves in such a setting? Is there a howto that explains how to do it?
Should I try to do things in a different way? (I'm ready to change my setup, as long as I can keep an offline copy of my email in sync with a server copy.)
Thanks a lot for any suggestion,
Alan
PS: I used to use SpamSieve (http://c-command.com/spamsieve/) on a Mac Mini that was running continuously as a spam filter drone. This machine has been retired and I'm basically looking for leaner ways to do a similar thing.
On 12-02-14 14:03, Alan Schmitt wrote:
Hello,
To easily access my mail both offline on my computer and on my phone, I am synchronizing a local copy on my computer using offlineimap. As the spam filtering options provided on the server are not sufficient, I am now looking into client-side spam filtering.
My current setup is as follows. Mail is synchronized using offlineimap, and delivered to a local dovecot server:
--8<---------------cut here---------------start------------->8--- [Repository LocalIMAP] type = IMAP preauthtunnel = /usr/local/Cellar/dovecot/2.2.10/libexec/dovecot/imap -c ~/.dovecotzimbra.rc --8<---------------cut here---------------end--------------->8---
The configuration of the local server is simply:
--8<---------------cut here---------------start------------->8--- protocols = imap mail_location = maildir:~/.Maildir/zimbra:INBOX=~/.Maildir/zimbra/.INBOX --8<---------------cut here---------------end--------------->8---
I then read my mail using gnus, and index it using notmuch.
A suggestion I've been considering is use the pigeonhole sieve extprograms plugin (http://wiki2.dovecot.org/Pigeonhole/Sieve/Plugins/Extprograms) to call the spam filter (I've been looking at dspam at the moment). However, I could not find how to configure the use of sieves in the context of offlineimap. Hence my questions:
Is it possible to use dovecot sieves in such a setting? Is there a howto that explains how to do it?
You could simply enable sieve in the dovecot environment. The offlineimap + dovecot setup you have running already can be left mostly intact: it has nothing to do with offlineimap.
You could just setup sieve per the dovecot wiki guidelines, and then create a sieve script that uses the ext_programs plugin to call dspam (or any other filter that adds headers and is able to print the message including those added headers to stdout).
I'm not sure if it's necessary to do the delivery to dovecot using Dovecot's deliver LDA, or that you can keep using the '...libexec/dovecot/imap' binary for that in order to have sieve support. Maybe someone else can fill that in.
Regards, Tom
Hello Tom,
Tom Hendrikx tom@whyscream.net writes:
You could simply enable sieve in the dovecot environment. The offlineimap + dovecot setup you have running already can be left mostly intact: it has nothing to do with offlineimap.
You could just setup sieve per the dovecot wiki guidelines, and then create a sieve script that uses the ext_programs plugin to call dspam (or any other filter that adds headers and is able to print the message including those added headers to stdout).
Thank you for the suggestion. This is indeed what I'm trying to do.
I'm not sure if it's necessary to do the delivery to dovecot using Dovecot's deliver LDA, or that you can keep using the '...libexec/dovecot/imap' binary for that in order to have sieve support. Maybe someone else can fill that in.
This is the crux of my question, I guess. Right now I don't deliver any mail, but use offlineimap to keep a local imap server (dovecot) in sync with a remote one. So my questions are:
- Can I use dovecot's sieves if I don't deliver mail?
- If not, how can I hook up offlineimap and dovecot so that mail is delivered instead of synchronized?
Thanks,
Alan
Alan Schmitt alan.schmitt@polytechnique.org writes:
This is the crux of my question, I guess. Right now I don't deliver any mail, but use offlineimap to keep a local imap server (dovecot) in sync with a remote one. So my questions are: 1. Can I use dovecot's sieves if I don't deliver mail? 2. If not, how can I hook up offlineimap and dovecot so that mail is delivered instead of synchronized?
Alan, you can use sieve with dovecot in an offline imap setup.
All you have to do is compile sieve into dovecot:
wget http://pigeonhole.dovecot.org/releases/2.2/dovecot-2.2-pigeonhole-0.4.2.tar....
untar it
cd /usr/local/src/dovecot-2.2-pigeonhole-0.4.2/
./configure --prefix=/usr/local/Cellar/pigeonhole/0.4.0 --with-dovecot=/usr/local/opt/dovecot/lib/dovecot make && make install
I did this on a Macbook with dovecot installed from hombrew.
Whenever imap process is launched by my mail client it automatically sorts my INBOX based on sieve rules.
I can also do this manually:
sieve-filter -e -W -v -C -u $USER ~/Messages/dovecot.sieve 'INBOX'
Hope that is of some help.
Damon
Hello Damon,
"Damon Haley" dkh@member.fsf.org writes:
Alan Schmitt alan.schmitt@polytechnique.org writes:
This is the crux of my question, I guess. Right now I don't deliver any mail, but use offlineimap to keep a local imap server (dovecot) in sync with a remote one. So my questions are: 1. Can I use dovecot's sieves if I don't deliver mail? 2. If not, how can I hook up offlineimap and dovecot so that mail is delivered instead of synchronized?
Alan, you can use sieve with dovecot in an offline imap setup.
All you have to do is compile sieve into dovecot:
wget http://pigeonhole.dovecot.org/releases/2.2/dovecot-2.2-pigeonhole-0.4.2.tar....
untar it
cd /usr/local/src/dovecot-2.2-pigeonhole-0.4.2/
./configure --prefix=/usr/local/Cellar/pigeonhole/0.4.0 --with-dovecot=/usr/local/opt/dovecot/lib/dovecot make && make install
I did this on a Macbook with dovecot installed from hombrew.
Whenever imap process is launched by my mail client it automatically sorts my INBOX based on sieve rules.
I can also do this manually:
sieve-filter -e -W -v -C -u $USER ~/Messages/dovecot.sieve 'INBOX'
Hope that is of some help.
This is most helpful, thanks a lot!
Alan
Hello Damon,
"Damon Haley" dkh@member.fsf.org writes:
Alan, you can use sieve with dovecot in an offline imap setup.
All you have to do is compile sieve into dovecot:
wget http://pigeonhole.dovecot.org/releases/2.2/dovecot-2.2-pigeonhole-0.4.2.tar....
untar it
cd /usr/local/src/dovecot-2.2-pigeonhole-0.4.2/
./configure --prefix=/usr/local/Cellar/pigeonhole/0.4.0 --with-dovecot=/usr/local/opt/dovecot/lib/dovecot make && make install
I did this on a Macbook with dovecot installed from hombrew.
Whenever imap process is launched by my mail client it automatically sorts my INBOX based on sieve rules.
I gave this a try, following the documentation from http://wiki2.dovecot.org/Pigeonhole/Sieve/Configuration
Unfortunately I have an error:
,---- | Establishing connection to tunnel:/usr/local/Cellar/dovecot/2.2.10/libexec/dovecot/imap -c ~/.dovecotzimbra.rc | Error: Can't load plugin sieve_plugin: Plugin is intended to be used only by binaries: lda lmtp (we're imap) | Fatal: Couldn't load required plugins `----
This is the configuration file I tried:
--8<---------------cut here---------------start------------->8--- protocols = imap mail_location = maildir:~/.Maildir/zimbra:INBOX=~/.Maildir/zimbra/.INBOX mail_plugins = $mail_plugins sieve
plugin { sieve = ~/.dovecot.sieve sieve_dir = ~/.sieve } --8<---------------cut here---------------end--------------->8---
The documentation says that one can only use the plugin with lda or lmtp. How do you use it with imap?
Thanks,
Alan
Alan Schmitt alan.schmitt@polytechnique.org writes:
Hello Damon, "Damon Haley" dkh@member.fsf.org writes:
Alan, you can use sieve with dovecot in an offline imap setup.
All you have to do is compile sieve into dovecot:
wget http://pigeonhole.dovecot.org/releases/2.2/dovecot-2.2-pigeonhole-0.4.2.tar.gz> untar it
cd /usr/local/src/dovecot-2.2-pigeonhole-0.4.2/
./configure --prefix=/usr/local/Cellar/pigeonhole/0.4.0 --with-dovecot=/usr/local/opt/dovecot/lib/dovecot make && make install
I did this on a Macbook with dovecot installed from hombrew.
Whenever imap process is launched by my mail client it automatically sorts my INBOX based on sieve rules.
I gave this a try, following the documentation from http://wiki2.dovecot.org/Pigeonhole/Sieve/Configuration
Unfortunately I have an error:
,---- | Establishing connection to tunnel:/usr/local/Cellar/dovecot/2.2.10/libexec/dovecot/imap -c ~/.dovecotzimbra.rc | Error: Can't load plugin sieve_plugin: Plugin is intended to be used only by binaries: lda lmtp (we're imap) | Fatal: Couldn't load required plugins `----
This is the configuration file I tried: protocols = imap mail_location = maildir:~/.Maildir/zimbra:INBOX=~/.Maildir/zimbra/.INBOX mail_plugins = $mail_plugins sieve
plugin { sieve = ~/.dovecot.sieve sieve_dir = ~/.sieve } The documentation says that one can only use the plugin with lda or lmtp. How do you use it with imap?
Anna,
I use lda.
Here are my relevant config files:
https://github.com/dhaley/feedyourbaby/blob/master/conf.d/15-lda.conf https://github.com/dhaley/feedyourbaby/blob/master/conf.d/90-sieve.conf
Hopefully that helps, although I'm guessing you've already figured it out.
Damon
Hi Damon,
dkh@member.fsf.org (Damon K. Haley) writes:
Here are my relevant config files:
https://github.com/dhaley/feedyourbaby/blob/master/conf.d/15-lda.conf https://github.com/dhaley/feedyourbaby/blob/master/conf.d/90-sieve.conf
Hopefully that helps, although I'm guessing you've already figured it out.
Thanks. I found out how to call dovecot as a lda from fetchmail, but could not see how to do it from offlineimap. So I'm now using the following architecture, which works well in practice but is a little bit complex.
#+begin_example +------------+ +-----------+ imap sync +----------+ +----------------+ |mail clients|-----|remote imap|----------------------|local imap|------| mail clients | |(webmail, | +-----------+ (offlineimap) |(dovecot) | |(gnus, Mail.app)| | smartphone)| | +----------+ +----------------+ +------------+ V ^ | | fetch mail and filter it | | \______________________________/ | (fetchmail + dovecot lda) | | +------------+ +---------------+ |mail storage|-----| mail indexing | | (maildir) | | (notmuch) | +------------+ +---------------+ #+end_example
Alan
Am 19.02.2014 12:20, schrieb Alan Schmitt:
Hi Damon,
dkh@member.fsf.org (Damon K. Haley) writes:
Here are my relevant config files:
https://github.com/dhaley/feedyourbaby/blob/master/conf.d/15-lda.conf https://github.com/dhaley/feedyourbaby/blob/master/conf.d/90-sieve.conf
Hopefully that helps, although I'm guessing you've already figured it out.
Thanks. I found out how to call dovecot as a lda from fetchmail, but could not see how to do it from offlineimap. So I'm now using the following architecture, which works well in practice but is a little bit complex.
#+begin_example +------------+ +-----------+ imap sync +----------+ +----------------+ |mail clients|-----|remote imap|----------------------|local imap|------| mail clients | |(webmail, | +-----------+ (offlineimap) |(dovecot) | |(gnus, Mail.app)| | smartphone)| | +----------+ +----------------+ +------------+ V ^ | | fetch mail and filter it | | \______________________________/ | (fetchmail + dovecot lda) | | +------------+ +---------------+ |mail storage|-----| mail indexing | | (maildir) | | (notmuch) | +------------+ +---------------+ #+end_example
Alan
guess not what you want but using getmail maybe more easy
i.e like
https://sys4.de/de/blog/2013/04/12/abholdienst-fur-mail/
Best Regards MfG Robert Schetterer
-- [*] sys4 AG
http://sys4.de, +49 (89) 30 90 46 64 Franziskanerstraße 15, 81669 München
Sitz der Gesellschaft: München, Amtsgericht München: HRB 199263 Vorstand: Patrick Ben Koetter, Marc Schiffbauer Aufsichtsratsvorsitzender: Florian Kirstein
Hi Robert,
Robert Schetterer rs@sys4.de writes:
guess not what you want but using getmail maybe more easy
i.e like
Thank you for the suggestion. It seems like using getmail would allow me to avoid needing the extprograms pigeonhole plugin. Another nice thing is that it does not need to have the IMAP password in clear text. I'll definitely give it a try.
Alan
participants (5)
-
Alan Schmitt
-
Damon Haley
-
dkh@member.fsf.org
-
Robert Schetterer
-
Tom Hendrikx