Re: [exim] Configuring mailbox quotas on large servers

Top Page
Delete this message
Reply to this message
Author: Phil Pennock
Date:  
To: Todd Lyons
CC: exim-users, Andy Smith
Subject: Re: [exim] Configuring mailbox quotas on large servers
On 2009-11-27 at 13:57 -0800, Todd Lyons wrote:
> The one minor issue is something that I am working on a solution for
> WRT Exim. At the point that the MTA hands off to the LDA (maildrop),
> it has already been determined that it will be accepted by Sendmail or
> Exim. It is at this point that the quota check is made, so if the
> account is over quota, the email gets TEMPFAIL'd (errorlevel returned
> is 77) and sits in the queue. An NDR message gets sent at the end of
> the queue lifetime if it can't be delivered into the home directory.


> Are there any other ways of doing this? If there are, nothing has
> come to mind and I welcome suggestions.


Two Routers which accept the same email. The first is set
"verify_only", the second is the maildrop Router, which is set
"no_verify".

You have the same preconditions (domains, etc) on both Routers.

On the first, you set "no_more", so that if it fails verification, the
routing won't go on to the second. This is why it's important to have
the same preconditions.

The first Router is a "redirect" router. You use "data" to decide where
to redirect to. You use string expansion in the "data = ..." line to
decide if the recipient is within quota.

If within quota, you redirect to a holding file: in practice, because
this is verify_only, you will never deliver to that file, so could use
/dev/null; but for safety's sake, redirect to a real file. Set up your
monitoring so that if that file ever grows to have length > 0 then you
alert fast, because something has gone wrong with a config push as
someone has removed verify_only.

If not within quota, you :defer: the expansion. Perhaps :fail:. Test.

You can use the string expansion to put in whatever check you want.

Now, if Exim has access to the mail storage area directly, you might use
an "accept" Router for the verify_only step and check quotas that way
(instead of the redirect's data = ...), but unless you're using mbox (or
other single-file) format, I think this would turn out to be a bad idea
in this case. Because you'd never deliver with Exim, you'd never update
the quota files used by Exim to cache the usage within the maildrop, so
every delivery might be an expensive calculation over the existing
files.

If you're using mbox format, this might not be so bad and you could try
it.

If you have the source to the maildrop command and can update it to also
update the quota files used by Exim, you could still do it this way.
This is what I'd probably do myself. But I've got strange tastes,
sometimes.

-Phil