[CentOS] Limiting maildir sizes with Postfix?

Tue Mar 24 21:30:23 UTC 2009
Bill Campbell <centos at celestial.com>

On Tue, Mar 24, 2009, nate wrote:
>Xn Nooby wrote:
>
>> How should I limit the Mailbox size of the users?
>>
>> I'm not very familiar with Linux "quotas", but I think that is my only
>> other choice.
>
>That is a good option, if you happen to be using Courier for your
>IMAP/POP3 this option exists as well:
>
>http://www.courier-mta.org/imap/README.maildirquota.html
>
>I have no experience with it myself(though I do use Courier in
>some places, just without quotas).

IHMO, by the time the mail is handed off for delivery into the
mail store, it's too late as one cannot return an appropriate 422
(mailbox full or user over quota) SMTP response to the sender.

Our solution has been to use a postfix hash table under
smtpd_recipient_restrictions which generates this response for
users who are over quota.  This hash is maintained by a cron job
that runs periodically to get users who are over their quotas.
The cron job parses ``repquota -a'' output to build the table,
and is quite fast.  One could also use an MySQL or postgresql
table for the same purpose, although I suspect the hash tables
are more efficient.

Bill
-- 
INTERNET:   bill at celestial.com  Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
Voice:          (206) 236-1676  Mercer Island, WA 98040-0820
Fax:            (206) 232-9186

DOS: n., A small annoying boot virus that causes random spontaneous system
     crashes, usually just before saving a massive project.  Easily cured by
     UNIX.  See also MS-DOS, IBM-DOS, DR-DOS.