[Dovecot] Dovecot 1.2.11, Quota and SQL
Hello,
I have a problem :(...
I try to define User Quotas in Dovecot (in my DB mySQL) but default quotas (in my dovecot.conf) are always set for all users.
I've defined default quota to 500M. I set 0 to one account in my DB but when i see my logs, this account have a 500M quota !
Could you help me ?
My configuration :
# 1.2.11: /etc/dovecot/dovecot.conf # OS: Linux 2.6.18-xenU i686 Debian 5.0.4 ext3 log_path: /var/log/dovecot.err info_log_path: /var/log/dovecot.info log_timestamp: %Y-%m-%d %H:%M:%S protocols: imap disable_plaintext_auth: no login_dir: /var/run/dovecot/login login_executable: /usr/lib/dovecot/imap-login mail_location: maildir:/var/vmail/%d/%n/.maildir mail_debug: yes mbox_write_locks: fcntl dotlock mail_plugins: quota imap_quota auth default: debug: yes debug_passwords: yes passdb: driver: pam passdb: driver: sql args: /etc/dovecot/dovecot-sql.conf userdb: driver: passwd userdb: driver: static args: uid=vmail gid=vmail home=/var/vmail/%d/%n userdb: driver: sql args: /etc/dovecot/dovecot-sql.conf socket: type: listen master: path: /var/run/dovecot/auth-master mode: 384 user: vmail group: vmail plugin: quota: maildir:User quota quota_rule: *:storage=500M quota_rule2: Trash:storage=10M
My dovecote-sql.conf :
driver = mysql connect = host=localhost dbname=mail user=mail password=MyPassWord default_pass_scheme = CRYPT password_query = SELECT full_address AS user, password FROM admin_mailbox WHERE full_address = '%u' user_query = SELECT path AS home, uid, gid, concat('*:storage=', quota, 'M') AS quota_rule FROM admin_mailbox WHERE full_address = '%u'
When I request my DB, it's OK :
mysql> SELECT path AS home, uid, gid, concat('*:storage=', quota, 'M') AS quota_rule FROM admin_mailbox WHERE full_address = 'toto@dom.tld'; +------------------------+-----+-----+--------------+ | home | uid | gid | quota_rule | +------------------------+-----+-----+--------------+ | dom.tld/toto/.maildir/ | 500 | 500 | *:storage=0M | +-------------- ---------+-----+-----+--------------+ 1 row in set (0.00 sec)
But when i see my logs :
IMAP(toto@dom.tld): Info: Loading modules from directory: /usr/lib/dovecot/modules/imap IMAP(toto@dom.tld): Info: Module loaded: /usr/lib/dovecot/modules/imap/lib10_quota_plugin.so IMAP(toto@dom.tld): Info: Module loaded: /usr/lib/dovecot/modules/imap/lib11_imap_quota_plugin.so IMAP(toto@dom.tld): Info: Effective uid=1002, gid=1004, home=/var/vmail/dom.tld/toto IMAP(toto@dom.tld): Info: Quota root: name=User quota backend=maildir args= IMAP(toto@dom.tld): Info: Quota rule: root=User quota mailbox=* bytes=524288000 messages=0 IMAP(toto@dom.tld): Info: Quota rule: root=User quota mailbox=Trash bytes=10485760 messages=0
Thanks for your help,
Mikaël,
Sorry,
I have resolved my problem !
"user_query" wasn't executed because i defined a "userdb_static". I have defined a "userdb_static" because Dovecot couldn't find my maildir locations... But it wasn't the good solution !
So :
1 - I removed "userdb_static" 2 - I modified my "dovecot-sql.conf" file to get an absolute path to home (my first problem was here in fact) :
user_query = SELECT concat('/var/vmail/', path) AS home, uid, gid, concat('*:storage=', quota, 'M') AS quota_rule FROM admin_mailbox WHERE full_address = '%u'
Now, it's OK :)
Thanks for Dovecot !
Mikaël,
participants (1)
-
Mikaël PIRIO