Sieve: Saving "pristine" messages for backups and spam training

Steffen Kaiser skdovecot at smail.inf.fh-brs.de
Tue Aug 12 08:15:42 UTC 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, 11 Aug 2014, Jeff Rice wrote:
>> Ben Johnson <mailto:ben at indietorrent.org>
>> August 11, 2014 at 5:52 PM
>> On 8/11/2014 11:42 AM, Jeff Rice wrote:

>>> I'm thinking of using the extprograms plugin to pipe to a program that
>>> will do a simple copy.  That feels very hackish, however, and I'm hoping
>>> there is a more elegant solution.
>> 
>> There is; the Dovecot Antispam plug-in. It does exactly what you
>> describe, and it addresses the problem of storing a duplicate copy of
>> all messages.
>> 
>> In short, when a user drags a message from any folder to "Junk", you'll
>> receive a "pristine" copy of the message at any local address you
>> specify, delivered to any folder you specify (e.g., "Train as SPAM")
>> within that "training user's" mailbox.
>> 
> Hmm.  Perhaps I'm just dense, but I don't see this behavior documented in the 
> Antispam plugin docs.  I'm happy to be corrected if I've misunderstood.  I'd 
> rather use an existing tool if possible.
>
> What I can see that Antispam will train on the version of the message the 
> user drags into the "Junk" folder.  But that message may have had headers 
> added by a sieve filter or Spamassassin, for example.  By "pristine", I mean 
> "as received" by the LDA.
>
> CRM114's "reaver_cache" is along the lines of what I'm thinking of.

How about this:

Your MTA forwards each message to a central mail account, where they get 
spooled and purged after n days by cron.
If you need a "pristine" copy of a message, you take the message from 
sieve, e.g. via antispam plugin, determine from Message-Id, recieved 
headers and whatsoever which "pristine" copy could be meant and use the 
one from the central store. That will also bypass changes of the message 
added because of delivery itself, because you know that this accounts has 
no Sieve and you can remove the last recived header etc.pp.

>> I thought fileinto :copy might do what I wanted, but this creates a backup 
>> directory individually for each user.  That's unmanageable for the spam 
>> training process I use. redirect *could* work, but that adds a header 
>> during the process so the email saved would not be "pristine".

If you think an early "sieve_before" command will do, try a hidden 
namespace, add write-only ACLs for everyone for one mailbox and "fileinto 
:copy" there.

The hidden namespace shall keep it from the eyes of most users, which 
would ask questions.

- -- 
Steffen Kaiser
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQEVAwUBU+nNLnz1H7kL/d9rAQK3/Af/XjlnbOXtSBcphjMZifx894IbJnDuCRVq
QMWbBLbsk+zsOiww9gKcC+99AA7+dPYyGf5E+33U1UkuFi8EwS2YT/IfkF4FeC4x
HZ+ERRHwVW5rJBtkx1BzjxWspuH+0X1R3CerdBGW2vifGZ6vr9uUk1gU1mG+kjB9
qp8cTh1PZxKcye3MR+bnbCH/lPNDAnvFVJtNnNBxweE2Ujd6QG4oepS+OH0QH+8R
QqiUF4vSrIDc1pcyLkzQus9oCyRaaveTTnuzq5CdQzTOF4awX3X0Co2HJyXokJHa
DToIoqd1Czawn/O2vxYoqTRf4ugxrZGx7oKw2YcGFH+/7SxXpU1fQg==
=/38s
-----END PGP SIGNATURE-----


More information about the dovecot mailing list