Re: [Exim] quota_warn_threshold specifics

Pàgina inicial
Delete this message
Reply to this message
Autor: Mark T. Valites
Data:  
A: exim-users
Assumpte: Re: [Exim] quota_warn_threshold specifics
Dan & Christian - thank you both for your replies. Further info and
questions are bulleted below...

On Fri, 18 Jun 2004, Dan Egli wrote:

> Mark T. Valites wrote:
>
> > I've been trying to test out the quota_warn_threshold capability on a
> > Maildir transport, but I haven't been able to get it to work yet.
> >
> > I'm starting to suspect that the 'quota' setting only considers the
> > contents of the directory specified in the 'directory' setting, not the
> > user's total disk usage on the file system of the 'directory' - can
> > someone confirm this for me?
>
> You're partially right. Exim cannot check the total space usage for a
> user against their quota. Different file systems store quota information
> differently, as do different O/S's. So what happens is that if you set a
> MTA quota, it checks to see if in writing the current file the user's
> quota would be exceeded. If you're not using a delivery agent (I've
> heard some people mention agents like Cyrus or something, but I don't
> know for sure), then the best way to do Quota issues is with a File
> system Quota. If a FileSystem quota is not an option you need a 3rd
> party delivery agent that can read the quota information and return it.
> I once heard (I think it was on this list, but don't remember for sure)
> of someone who had some kind of hack that allowed quota usage to work
> correctly, but it was so long ago I don't recall for sure.


On Sat, 19 Jun 2004, Christian Balzer wrote:

> Pasting the relevant bits of your transport would help a bit, but
> basically yes. This is all rather well documented, too. Exim


The wording in the documentation is what confused me in the first place...

"the total space used in the directory tree when the directory option is
set."

I wasn't sure if that meant the user's directory space in the file system
the 'directory' setting was set to, or the directory itself. I see now
it's the later of the two.

> uses the actually used bytes instead of the FS blocks. In a maildir
> scenario it will take all the files and subdirectories in that
> mail directory into account. If you have a OS/FS based quota in place
> see Dan Egli's reply, but if you want to use exim's quota mechanism
> make sure that you don't have FS quotas on that user/maildir or that
> those quotas are 50-100% higher than what exim is set to. YMMV.


I'm currently using file system quotas on an x86 Debian box
(exim4-daemon-heavy, Version: 4.32-2), but my production setup will use
file system quotas on a Solaris 9 machine. I guess I could *kinda/sorta*
extract file system quota numbers by calling a perl_startup script that
uses the Quota module essentially looking something like this:

Use Quota;

sub get_quota_percentage {
        my $user = $_[0];
        my $uid = (getpwnam ($user))[2];
        my $home = (getpwnam ($user))[7];
        my $dev = Quota::getqcarg($home);


        my ($bc,$bs,$bh,$bt, $ic,$is,$ih,$it) = Quota::query($dev, $uid);


        my $usage_percentage = $bc/$bh*100;
        return $usage_percentage;
}


sub get_quota_megs {
        my $user = $_[0];
        my $uid = (getpwnam ($user))[2];
        my $home = (getpwnam ($user))[7];
        my $dev = Quota::getqcarg($home);


        my ($bc,$bs,$bh,$bt, $ic,$is,$ih,$it) = Quota::query($dev, $uid);


        my $megs = $bs/1000;
        my $english = $megs."M";
        return $english;
}


My transport looks like this:

maildir_home:
debug_print = "T: maildir_home for $local_part@$domain"
driver = appendfile
directory = $home/Maildir
delivery_date_add
envelope_to_add
return_path_add
maildir_format
maildir_tag = ,S=$message_size
mode = 0600
mode_fail_narrower = false
quota_is_inclusive = false
#quota = ${perl{get_quota_megs}{$local_part}}"
quota = 10M
quota_warn_threshold = 50%
quota_warn_message = "\
To: $local_part@$domain\n\
Subject: Your mailbox at $domain\n\n\
Some more text...\n\n"

From the commented out line, you can probably see where I was going, until
the recent realization that the quota mechanism in Exim only applies to
the mail file/directory Exim in working with.

Dan mentioned someone might have once conjured something up that might fit
my needs, but I wasn't able to find anything by digging through the
archives. If anyone has a link or an idea to somehow be able to use
quota_warn_threshold work with file system based quotas (or achieve
similar behavior), I'd be most grateful.

Failing that, I'll probably just modify an existing cron based script I
use wrote for my sendmail/procmail Maildir setup to warn users they've
crossed a threshold.

Which brings me to hopefully my last two quota related questions:

-The documentation mentioned that retry rules were able to determine if a
termporary delivery failure was the result of a user being over quota. Is
this just Exim quotas? or will it be able to detect a file system quota
problem?

-Secondly, how exactly do to the retry rules determine when a mailbox was
last read?

Thanks,
-Mark

--
Mark T. Valites
Unix Systems Analyst
Computing & Information Technology
SUNY Geneseo
>--))> >--))>