Wolfram Schlich
2009-Jun-12 15:54 UTC
[Dovecot] Dovecot as a (quota) policy server for Postfix
Hi guys, I'm currently experimenting with Postfix, Dovecot and OpenLDAP to setup a mail server hosting virtual users. The standard stuff works fine so far. The only thing that doesn't work as I'd like it to do is Quota. Currently, Dovecot handles/enforces quota through the deliver LDA. When Postfix tries to deliver a mail to a mailbox that is over quota, the deliver LDA bounces the mail back to the sender. I don't like that. I'd rather prefer Postfix to reject the mail right after receiving the '.' DATA termination line and having checked whether the users quota is or would be exceeded. This could work by writing a small Postfix policy server/daemon that does exactly that Dovecot does: - get the user quota limit from userdb (from LDAP in my case) - get the user quota used (from maildirsize in my case) _ check whether the current mail size + quota used exceed the quota limit and if true, reject the mail Of course this would only work for mails going to a single local recipient address, but most of the time, that's just the case. Now I can re-implement that part of functionality from Dovecot in Perl and write such a small policy daemon that does exactly fit my setup (LDAP + maildirsize). There's one thing I'd like much better, though: What about extending Dovecot by a small policy server module for Postfix? Dovecot already has all the code to do the "over quota" checks and supports a great number of combinations for quota limit and used quota storage. My Postfix instance already kinda depends on a running Dovecot due to Dovecot-SASL for SMTP-Authentication and Dovecot-deliver for mail delivery, so it wouldn't introduce a completely new dependency either. Timo (and all others), what do you think about such a Postfix policy server implemented as a part of Dovecot? -- Regards, Wolfram Schlich <wschlich at gentoo.org> Gentoo Linux * http://dev.gentoo.org/~wschlich/
Timo Sirainen
2009-Jun-12 16:21 UTC
[Dovecot] Dovecot as a (quota) policy server for Postfix
On Fri, 2009-06-12 at 17:54 +0200, Wolfram Schlich wrote:> Timo (and all others), what do you think about such a Postfix > policy server implemented as a part of Dovecot?Dovecot v2.0 makes this much easier, since it can be extended with any kind of external services without recompiling anything. Also v2.0 tries to be somewhat compatible with Postfix master. I've had in mind that perhaps Dovecot services could run also under Postfix master. So a quota service that could run either under Dovecot or Postfix could be useful. I don't really have time to implement it though. You could take a look at how LMTP server is implemented and just copy&paste its important parts and make it report quota instead of doing the LMTP stuff. What does Postfix's policy protocol look like anyway? -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: This is a digitally signed message part URL: <http://dovecot.org/pipermail/dovecot/attachments/20090612/fccbbc37/attachment-0002.bin>