----- Original Message -----
From: "Gustavo Silva" <pseudo (at mark) zbronx.com>
To: <coba-e (at mark) bluequartz.org>
Sent: Wednesday, July 11, 2007 10:53 AM
Subject: [coba-e:10377] Re: mail delivery with users already over quota
> Hi Blues,
>
> Regarding my previous topic (local delivery to over quota users
> and/or almost full quotas, that will become locked and unresponsive
> untill you give them more free space)
>
> This procmail recipe kinda works.
> Avoids the mailbox to fill up and become unresponsive. Or so i think..
>
> Notes:
> - beware if your postmaster account redirects to a over quota box,
> can create quite a fun loop
>
> - ive attached all of my /etc/procmailrc contents,
> so beware especially because of clamassassin wrapper etc.
>
> - on overquota error, im exiting with code 69 SERVICE UNAVAILABLE,
> you can add more codes to /usr/include/sysexits.h but i could use some
> help here...
> or in sending a custom error email to the sender
>
>
> -----------cut here-----------------------------
>
> # LET PROCMAIL HAVE SHELL ACCESS
> SHELL=/bin/sh
>
> # SPECIFY THE LOGFILE
> LOGFILE=/var/log/procmail.log
>
> # OUR FREE SPACE TRESHOLD, only deliver if
> messagesize<=quotalimit-treshold
> TRESH=256000
>
> # GRAB OUR REAL *NIX USERNAME
> USER=`echo $DEFAULT | cut -d"/" -f8`
>
> # CHECK HOW MUCH FREE SPACE USER HAS
> QUOTA=`quota -u $USER | tail -n 1 | awk '{print (($3-$2)*1024)-$TRESH}'`
>
> # BEGIN RECIPES
> DROPPRIVS=yes
>
> # IF MESSAGE IS BIGGER THAN FREE SPACE
> :0
> * > $QUOTA
> {
> LOG="$USER has less than $TRESH bytes free space or is Over Quota,
> messages are being bounced."
> EXITCODE=69
> }
>
> # SEND TO SPAMASSASSIN
> :0fw
> * <256000
> | /usr/bin/spamc
>
> # SEND TO CLAMASSASSIN
> :0fw
> | /usr/local/bin/clamassassin
>
> # Spam level 7.0 or greater: autodelete
> :0:
> * ^X-Spam-Level: \*\*\*\*\*\*\*
> /dev/null
>
> # Virus found: autodelete
> :0:
> * ^X-Virus-Status: Yes
> /dev/null
>
> # Work around procmail bug: any output on stderr will cause the "F" in
> "From"
> # to be dropped. This will re-add it.
> :0
> * ^^rom[ ]
> {
> LOG="*** Dropped F off From_ header! Fixing up. "
> :0 fhw
> | sed -e '1s/^/F/'
> }
>
> # FINAL STEPS, DELIVER TO MBOX
> ORGMAIL=$HOME/mbox
> DEFAULT=$ORGMAIL
>
> -----------cut here-----------------------------
>
>
>
>
>
>
>
> Kind regards,
>
> Gustavo
>
>
>
>
>
> Gustavo Silva escreveu:
>> Hi blues,
>>
>> Another "thing" im trying to come up with...
>>
>> I dunno if i am the only one with this kind of problems... Some stuff
>> that happens here is so weird.. oh well
>> Basically, some users like to check their pop accounts twice a year.. or
>> so it seems
>> The problem is that the account fills up, and gets blocked. I dunno if
>> this is beacuse i have set up things wrong of its just natural.
>>
>> By blocked i mean that if they try to check their emails and download
>> them from a email client, they cant logon because the account is over
>> quota and returns an error. Even trhough OpwenWebmail the same happens.
>>
>> So i have to login on BQ, give the user a little more space, then let it
>> download the emails, then put the account back as it was...
>>
>> Anyway i was wondering... Tell me if this is possible..
>> Create a Procmail recipe, or check on sendmail local delivery policy,
>>
>> And basically make a rule that would do the math for us
>>
>> if (client_actual_quota + this_email_message_size <=
>> (client_quota_limit-100kb_buffer)){
>> deliver
>> }else{
>> bounce like it would normally do when its over quota
>> }
>>
>> Heh... Am i being too radical?
>>
>> Kind regards,
>>
>> Gustavo
>>
Gustavo
Probably you could set up a cron to run a perl script check the running
processes and if a spamd process is running for more than a minute, then
check/increase the quota of the non-root user owning that process.
ps fauxw | grep spamd
That will avoicd the problme of checking the quota with each email.
----
Ken Marcus
Ecommerce Web Hosting by
Precision Web Hosting, Inc.
http://www.precisionweb.net