[Dovecot] Attachment extraction, de-duplication

Patrick Nagel patrick.nagel at star-group.net
Fri Aug 14 13:10:56 EEST 2009


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

Hi,

On 2009-08-14 17:36, Steffen Kaiser wrote:
>> able to see all attachments of all other mail receivers. So this only 
>> works in a cooperative environment.
> 
> One can extend that scheme a bit.
> 
>> In short, a script (implemented as filter, getting called by postfix) 
>> extracts all attachments on arrival, using ripmime [1]. The attachments
> 
> We use MIMEDefang on the recieving MTA.
> 
> There I remove certain MIME parts and put them on a Webspace, the filename
> (aka URL) is the seeded SHA1 of the content. So it is not easy to guess an
> URL without already knowing the seed and the content or the mail itself.
> 
> However, the reactions to this action is quite wide spread. Some are glad,
> because they can download attachments on demand, others hate this extra
> step. Some user think the mail is altered and the copyright of the sender is
> infringed. In a few cases, I ripped some pictures from a HTML mail, which
> caused uproar. Also, the S/Mime and PGP signing won't work, if transmitted
> in a separate MIME part.

Yes, with the security comes the hassle (as usual) - what I forgot to mention
was, that the script also inserts a file:/// link to the directory that
contains the attachment(s) (for each mail with attachment a new directory is
created on the share). So the users can just click that link and their
filebrowser opens. They can then see all attachments of a mail, and they can
really "work" with them, not just download them (one by one).

The rest sounds familiar ;) I inserted some conditions on which the script
stops processing the message, and just passes it along, as if it didn't have an
attachment - for example when it finds any signs of PGP signing or encryption...

Another thing that I didn't mention: We do the same for sent mails - a cronjob
periodically checks the users' Sent folders for mails that don't already
contain the "has been checked for attachments" header (we use maildir; it only
checks mails of the last 24 hours for obvious performance reasons). If it finds
one, it gets processed by the script - and in any case (attachments or not) it
gets the "has been checked for attachments" header set. Afterwards it gets
passed to deliver, which files it back into the Sent folder.
I wonder if there is a better solution for this... something with inotify would
probably help a lot. And sieve being able to call the script would also help a
lot ;)

The biggest catch for our users seems to be, that they have to re-attach the
file(s) if they want to forward an e-mail. But I think they got used to it, and
maybe it helps in promoting protocols that are actually made for transferring
files ;)

Patrick.

- -- 
STAR Software (Shanghai) Co., Ltd.              http://www.star-group.net/
Phone:    +86 (21) 3462 7688 x 826               Fax:   +86 (21) 3462 7779

PGP key:  E883A005 https://stshacom1.star-china.net/keys/patrick_nagel.asc
Fingerprint:             E09A D65E 855F B334 E5C3 5386 EF23 20FC E883 A005
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAkqFOC0ACgkQ7yMg/OiDoAXRkgCfctN/cZtAeB6Dglp8LKO1EY0E
XPsAoKdHxBsyk3JprgbELqfH8/QvE8pt
=dWMn
-----END PGP SIGNATURE-----


More information about the dovecot mailing list