Re: [Dovecot] Quota does not apply.

2008-08-12 Thread Timo Sirainen

On Aug 4, 2008, at 3:02 PM, Dario Ale wrote:

But, if I configure a high global quota and a small quota for INBOX,  
sent a mail that is more big that quota for INBOX, then quota is not  
applied and the mail is delivered to INBOX.


The quota configuration doesn't really work the way you think it works.

dovecot: Aug 04 15:47:03 Info: IMAP(dario.a): Quota rule: root=  
mailbox=* bytes=209715200 (0%) messages=0 (0%)
dovecot: Aug 04 15:47:03 Info: IMAP(dario.a): Quota rule: root=  
mailbox=.mbox bytes=10485760 (0%) messages=0 (0%)


The second quota rule matches to a mailbox called .mbox. If you  
wanted it to match INBOX, you should have used INBOX there. Quota code  
sees only the virtual mailbox names, not the physical file/directory  
names.


Secondly, you can't reduce the quota for specific mailboxes. With the  
above configuration you're giving .mbox mailbox 10 MB of more space  
(so 210 MB total).


Sounds like what you want to do is change your MTA configuration not  
to allow incoming mails larger than 10 MB.




PGP.sig
Description: This is a digitally signed message part


[Dovecot] Quota does not apply.

2008-08-04 Thread Dario Ale
Hello list:
I am try to run quota plugin but only works a part.

The users are virtual and his homedir and mbox are in NFS server, INDEX files 
are in local disk.

Quota only is applied to global home, if I configure a low global quota and 
sent an mail to my e-mail, quota works fine, mail is temporally deferred.

But, if I configure a high global quota and a small quota for INBOX, sent a 
mail that is more big that quota for INBOX, then quota is not applied and the 
mail is delivered to INBOX.
  
IMAP log and LDA log are equals, why I only pasted IMAP log:

...
dovecot: Aug 04 15:47:03 Info: IMAP(dario.a): Loading modules from directory: 
/usr/lib/dovecot/imap
dovecot: Aug 04 15:47:03 Info: IMAP(dario.a): Module loaded: 
/usr/lib/dovecot/imap/lib10_quota_plugin.so
dovecot: Aug 04 15:47:03 Info: IMAP(dario.a): Module loaded: 
/usr/lib/dovecot/imap/lib11_imap_quota_plugin.so
dovecot: Aug 04 15:47:03 Info: IMAP(dario.a): Effective uid=1002, gid=1002, 
home=/vmail/telpin.com.ar/d/dario.a/
dovecot: Aug 04 15:47:03 Info: IMAP(dario.a): Quota root: name= backend=dict 
args=:proxy::quotadict
dovecot: Aug 04 15:47:03 Info: IMAP(dario.a): dict quota: user=dario.a, 
uri=proxy::quotadict, enforcing=0
dovecot: Aug 04 15:47:03 Info: IMAP(dario.a): Quota rule: root= mailbox=* 
bytes=209715200 (0%) messages=0 (0%)
dovecot: Aug 04 15:47:03 Info: IMAP(dario.a): Quota rule: root= mailbox=.mbox 
bytes=10485760 (0%) messages=0 (0%)
dovecot: Aug 04 15:47:03 Info: IMAP(dario.a): Quota warning: bytes=199229440 
(95%) messages=0 (0%) command=/usr/local/bin/quota-warning.sh 95
dovecot: Aug 04 15:47:03 Info: IMAP(dario.a): Quota warning: bytes=167772160 
(80%) messages=0 (0%) command=/usr/local/bin/quota-warning.sh 80
dovecot: Aug 04 15:47:03 Info: IMAP(dario.a): mbox: 
data=/vmail/telpin.com.ar/d/dario.a/:INDEX=/etc/dovecot/dovecot-indexes/vmail/telpin.com.ar/d/dario.a/:INBOX=/vmail/telpin.com.ar/d/dario.a/.mbox
dovecot: Aug 04 15:47:03 Info: IMAP(dario.a): fs: 
root=/vmail/telpin.com.ar/d/dario.a, 
index=/etc/dovecot/dovecot-indexes/vmail/telpin.com.ar/d/dario.a, control=, 
inbox=/vmail/telpin.com.ar/d/dario.a/.mbox
...

But in my home I have 175M (included 13M of INBOX).

In quota table, my relared rows are:

| dario.a | quota/storage  | 183393060 |
| dario.a | quota/messages |   335 |
  
My Dovecot configuration is:

# 1.1.2: /etc/dovecot.conf
protocols: pop3 pop3s imap imaps
valid_chroot_dirs: %h
mail_location: mbox:%h:INDEX=/etc/dovecot/dovecot-indexes%h:INBOX=%h.mbox
mail_nfs_storage: yes
mail_plugins(imap): quota imap_quota
mail_plugin_dir(default): /usr/lib/dovecot/imap
mail_plugin_dir(imap): /usr/lib/dovecot/imap
auth default:
  passdb:
driver: sql
args: /etc/dovecot-mysql.conf
  userdb:
driver: sql
args: /etc/dovecot-mysql.conf
  socket:
type: listen
master:
  path: /var/run/dovecot/auth-master
  mode: 0600
  user: vmail
  group: vmail
plugin:
  quota: dict:::proxy::quotadict
  quota_rule: *:storage=200M
  quota_rule2: .mbox:storage=10M
  quota_warning: storage=95%% /usr/local/bin/quota-warning.sh 95
  quota_warning2: storage=80%% /usr/local/bin/quota-warning.sh 80
dict:
  quotadict: mysql:/etc/dovecot-dict-quota.conf

Others configurations are:

/etc/dovecot-dict-quota.conf
connect = host=HOST dbname=BD user=USER password=PASSWD
table = quota
select_field = current
where_field = path
username_field = email

Thanks for the time and sorry for my bad english.

--
Dario Ale (dario.a en telpin.com.ar)