[Dovecot] still having difficulties with per-user quotas
Hello,
I am trying to get per-user quotas working. My thanks to all who have helped so far.
To recap I am running Dovecot 2.1 and Mysql where I've got my virtual users. All virtual users are under the system user vmail with a UID and GID of 5000. Looking over the wiki docs I've added a quota table and got the dict service working, I am not having problems with permissions or the login username and password, all that is working fine. Here's my current doveconf -n output it is producing the following debug error related to the userdb sql query:
# 2.1.10: /etc/dovecot/dovecot.conf # XXX dict { quota = mysql:/etc/dovecot/dovecot-dict-sql.conf.ext } first_valid_gid = 5000 first_valid_uid = 5000 hostname = XXX last_valid_gid = 5000 last_valid_uid = 5000 mail_location = maildir:/home/vmail/%d/%n:LAYOUT=fs mail_plugins = " quota" namespace inbox { inbox = yes location = prefix = } passdb { args = /etc/dovecot/dovecot-sql.conf.ext driver = sql } plugin { quota = dict:User quota::proxy::quota quota_rule = *:storage=1G quota_rule2 = Trash:storage=+100M quota_warning = storage=95%% quota-warning 95 %u quota_warning2 = storage=80%% quota-warning 80 %u } protocols = imap service auth { unix_listener /var/spool/postfix/private/auth { group = postfix mode = 0660 user = postfix } unix_listener auth-userdb { mode = 0600 user = vmail } } service dict { unix_listener dict { mode = 0600 user = vmail } } service imap-login { inet_listener imap { address = 127.0.0.1 ::1 } inet_listener imaps { address = xxx xxxx ssl = yes } } service quota-warning { executable = script /usr/local/bin/quota-warning.sh user = vmail } ssl_cert =
Oct 19 15:23:52 auth-worker(29279): Info: mysql(/var/run/mysqld/mysqld.sock): Connected to database mail Oct 19 15:23:52 auth-worker(29279): Debug: sql(xxx,::1): query: SELECT user as user, password FROM virtual_users WHERE user='xxx@domain'; Oct 19 15:23:52 auth: Debug: client passdb out: OK 1 user=xxx Oct 19 15:23:52 auth: Debug: master in: REQUEST 3523346433 29276 1 f5cd16e3f5e078c28d850749e42c86cc Oct 19 15:23:52 auth-worker(29279): Debug: sql(xxx,::1): SELECT concat('*:storage=', bytes, 'M') as quota_rule FROM quota WHERE username='xxx'; Oct 19 15:23:52 auth: Debug: master userdb out: USER 3523346433 xxx quota_rule=*:storage=368485M Oct 19 15:23:52 imap-login: Info: Login: user=<xxx>, method=PLAIN, rip=::1, lip=::1, mpid=29282, secured, session=</xKpcW7MFgAAAAAAAAAAAAAAAAAAAAAB> Oct 19 15:23:52 imap(xxx): Error: user xxx: Couldn't drop privileges: User is missing UID (see mail_uid setting) Oct 19 15:23:52 imap(xxx): Error: Internal error occurred. Refer to server log for more information.
I am wanting a majority of my users to have the global 1GB quota, but the users in the quota table to have given quotas. Here's what the virtual_users and quota tables look like:
mysql> describe virtual_users; +-----------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-----------+--------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | domain_id | int(11) | NO | MUL | NULL | | | user | varchar(40) | NO | | NULL | | | password | varchar(128) | NO | | NULL | | +-----------+--------------+------+-----+---------+----------------+ 4 rows in set (0.00 sec)
mysql> describe quota; +----------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+--------------+------+-----+---------+-------+ | username | varchar(100) | NO | PRI | NULL | | | bytes | bigint(20) | NO | | 0 | | | messages | int(11) | NO | | 0 | | +----------+--------------+------+-----+---------+-------+ 3 rows in set (0.00 sec)
I'd appreciate any help.
Thanks. Dave.
David Mehler wrote:
Oct 19 15:23:52 imap(xxx): Error: user xxx: Couldn't drop privileges: User is missing UID (see mail_uid setting)
Set the following options in your dovecot.conf:
mail_uid = vmail mail_gid = vmail
Also see section "Mail users" at http://wiki2.dovecot.org/UserIds
Regards Daniel
Hello,
Thank you for your reply. Adding mail_uid and mail_gid fixed it. I now have quotas going but I don't know if I have them right or just don't like my setup.
My first issue is from what it is looking like I have to define all my users in the quota database not just the ones whose values I want to override the global quota declaration in 90-quota.conf. If I just add the user@domain to the database the bytes and messages columns have zero as default, this means those values override global quota in 90-quota.conf and they effectively have unlimited access.
My second issue is I have entered a quota of 250 megabytes for a test user. This works but he seems to get more space everytime he logs in, started out at 250, on the next login it was 255, then 269 on the third, and so forth. I've checked the quota table and yes the value in the bytes column is increasing.
Thanks for any help.
Dave.
On 10/20/12, Daniel Parthey daniel.parthey@informatik.tu-chemnitz.de wrote:
David Mehler wrote:
Oct 19 15:23:52 imap(xxx): Error: user xxx: Couldn't drop privileges: User is missing UID (see mail_uid setting)
Set the following options in your dovecot.conf:
mail_uid = vmail mail_gid = vmail
Also see section "Mail users" at http://wiki2.dovecot.org/UserIds
Regards Daniel
David Mehler wrote:
My first issue is from what it is looking like I have to define all my users in the quota database not just the ones whose values I want to override the global quota declaration in 90-quota.conf. If I just add the user@domain to the database the bytes and messages columns have zero as default, this means those values override global quota in 90-quota.conf and they effectively have unlimited access.
This is expected behavior. If the userdb returns a quota rule, it overrides the global quota rule. Extend your SQL query to return a default quota_rule for rows without quota entry.
My second issue is I have entered a quota of 250 megabytes for a test user. This works but he seems to get more space everytime he logs in, started out at 250, on the next login it was 255, then 269 on the third, and so forth. I've checked the quota table and yes the value in the bytes column is increasing.
Please show output of doveconf -n and any external (sql/dict) includes related to quota or quota_rules.
Regards Daniel
participants (2)
-
Daniel Parthey
-
David Mehler