SUMMARY: Mail Quotas

From: J. Adams (jna@concorde.com)
Date: Thu May 26 1994 - 16:17:37 CDT


Apologies for not summarizing this earlier, things got WAY too busy
around here.

First, the original question, as posted to sun managers. Abort now if
you're not interested in a tirade about mail quotas, that runs from both
the technical and logistic aspects of controlling and limiting mail.

> How do I create quotas on incoming mail? We want to reject mail and
> send it back to the sender if the user is over quota.
>
> We already have quotas established for /var, but it doesn't seem to
> help. Sendmail, as it's running setUID root just puts the mail in
> their mailbox anyway (/var/spool/mail/$USER)
>
> We know that /bin/mail is used for local mail delivery... Could we
> make some changes in the /etc/sendmail.cf that call a different
> "external" mailer program, like, one that would check for quotas and
> send replies back to the sender?
>
> (We'd probably write it in perl or something...)
>
> Any ideas / How do you implement mail quotas at your site?
>
> -john

Many thanks to:

Ric Anderson <ric@Artisoft.COM>
Eckhard.Rueggeberg@ts.go.dlr.de (Eckhard Rueggeberg)
Dan Schlitt <dan@ees1s0.engr.ccny.cuny.edu>
ted@mailhost.to.ford.com
Harish Malneedi <harishm@pcsdnfs1.eq.gs.com>
Mr T Crummey (DIJ) <tom@sees.bangor.ac.uk>
mills@CC.UManitoba.CA
Aydin Edguer <edguer@MorningStar.Com>
crm@lgi.com (Charles Mengel - LGI - Systems Eng Mgr)
Tom Reingold <tommy@big.att.com>

Our Solution?
 We realized the importance of saving mail. Mail is a lifeline for some
 companies, as it is slowly becoming a part of ours. The mail-bouncing idea
 was tossed away in favor of a mail-moving / notification one. We created
 two new perl programs: One that checks for users that are over (or close to)
 quota, and another that automagically moves the mail into their home
 directory after they've been over quota for awhile. These programs will be
 in the NEXT message.

 We run the first program, mail_hogs, every three days. it checks to see if
 people are over quota, and then sends them mail. We establish a soft limit
 (300000) and a hard limit (500000) as reference points. Mail is sent to the
 users when they are over 60% of their quota. We would like to create a more
 efficent means of sending them mail (maybe don't send them mail again until
 they are 80% over or something like that), but the once every 3 days thing
 seems to be working.

Mail responses from sun-managers people follow. Thanks guys!
-------------------------------------------------------------------------------

>From ric@Artisoft.COM Thu May 12 23:53:00 1994

We don't bounce mail, but we do monitor (via a simple awk script run
nightly) the size of /var mail files.

-------------------------------------------------------------------------------

From: Eckhard.Rueggeberg@ts.go.dlr.de (Eckhard Rueggeberg)

Not that I know an answer to your problem, but I (in an Research Company)
I would better buy a 2 GB disk than rejecting a single mail. I know there
are notorious mail abusers, but hitting their head manually would be a
solution far superior than mail quotas. If I imagine a very importatant
e mail being rejected because some jokester flooded a mailbox, we could
loose a contract and a lot of money....

-------------------------------------------------------------------------------
jna> Some good points below from dan.. thanks.
-------------------------------------------------------------------------------
From: Dan Schlitt <dan@ees1s0.engr.ccny.cuny.edu>

Bouncing mail that is addressed to people in your organization doesn't
seem to be to swift an idea. What are the senders going to think? What
if messages critical to your organization get bounced?

-------------------------------------------------------------------------------
From: Harish Malneedi <harishm@pcsdnfs1.eq.gs.com>

What system/os do you have? In sun-os you can implement quota system
on # of files/# of blocks or #of blocks per user per directory.
RTM quota(1), it comes with conf files for site specific configuration.

jna> But As Sendmail runs as root, this blows this idea out of the water.

I guess writing a perl script would be safer that you basically have
control on mail, my advice is not to edit sendmail.cf file unless
you are very comfortable with doing it. One pointer for external
mail handler from me will be "mime". Heard people using it to deal
with similar line of problems, but i never tried it.
jna> see sun-managers message next!

-------------------------------------------------------------------------------
From: Mr T Crummey (DIJ) <tom@sees.bangor.ac.uk>

Hello John,

We use a script that checks the size of the user's mailbox every night and
then dumps it into his home directory if it's too big. The the script sends
an email telling the user what has happened to his mail.

------------------------------------------------------------------------------
From: mills@CC.UManitoba.CA

You might be interested in `mailclean', available by anonymous FTP
from ftp.cc.umanitoba.ca, in the src directory. It doesn't bounce
mail, but it does limit the size of mailboxes.

------------------------------------------------------------------------------
From: Aydin Edguer <edguer@MorningStar.Com>

> We know that /bin/mail is used for local mail delivery... Could we
> make some changes in the /etc/sendmail.cf that call a different
> "external" mailer program, like, one that would check for quotas and
> send replies back to the sender?

Yes.

> Any ideas / How do you implement mail quotas at your site?

Do e-mail expiration.

  if (size(mbox) > limit) then
        if (!special_user) then
                while (("Date:" > ndays) && (size(mbox) > limit)) {
                        delete message;
                }

jna> It takes alot of work to expire mail. Too much for a simple perl script.
jna> maybe if I have more time I'll consider this option.

------------------------------------------------------------------------------
From: Tom Reingold <tommy@big.att.com>

I have never implemented such a quota but I believe the trick lies in
the line in sendmail.cf that says "Mlocal /bin/mail ...". You can
change the local delivery program to anything you like. I have heard
lots of praise about procmail which you can slip in here in place of
/bin/mail. Perhaps procmail allows you to establish quotas. If not,
you might consider tinkering with the source code to procmail rather
than to /bin/mail.
------------------------------------------------------------------------------
From: stevenho@netcom.com (Steven Ho)

A bug in sendmail that caused the quotas problem. Sendmail uses
/bin/mail to do local delivery and /bin/mail actually checks if
a user excedes his quota. The bug is that sendmail doesn't understand
the returned code, thus the failure. There was a patch under making
months ago for Solaris 2.x, I don't know if it's available for 4.x
though.

Hope this helps,

Steven Ho
stevenho@netcom.com



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:09:02 CDT