[Dovecot] still having difficulties with per-user quotas

David Mehler dave.mehler at gmail.com
Fri Oct 19 23:11:07 EEST 2012


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 = </etc/ssl/certs/server.crt
ssl_key = </etc/ssl/private/server.key
userdb {
  args = /etc/dovecot/dovecot-sql.conf.ext
  driver = sql
}
protocol imap {
  mail_plugins = " quota imap_quota"
}

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 at 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.



More information about the dovecot mailing list