[Dovecot] dovecot 1.2 quota with local users
Hello, I got problem with setting quota from mysql for local users. In database are only information with quota. Password are store in passwd/shadow.
My database have only simple info like in wiki description. Table created with:
CREATE TABLE quota ( username varchar(100) not null, bytes bigint not null default 0, messages integer not null default 0, primary key (username) );
In dovecot.conf like in description is:
dict { quotadict = mysql:/etc/dovecot-dict-sql.conf }
plugin { # v1.2 + SQL: quota = dict:user::proxy::quotadict # v1.2 + file: quota = dict:user::file:%h/Maildir/dovecot-quota
quota_rule = *:storage=10M:messages=1000 }
File dovecot-dict-sql.conf has:
# v1.2+ only: connect = host=localhost dbname=mails user=sqluser password=sqlpass map { pattern = priv/quota/storage table = quota username_field = username value_field = bytes } map { pattern = priv/quota/messages table = quota username_field = username value_field = messages }
With corrected values about databasename, user and password.
Where should to add information about sql query when autorization is not via myqsl (only shadow/password). There are in description info about additional file with user_query: dovecot-mysql.conf. Can anybody know how it should it look like and where to add it in config?
On Wed, 2011-03-16 at 11:38 +0100, iti@promax.media.pl wrote:
I got problem with setting quota from mysql for local users. In database are only information with quota. Password are store in passwd/shadow.
You mean you only want quota limits to be listed in SQL, right? Then you don't need to use dict quota at all (or especially not sql dict).
So what you need to use is passdb pam and userdb sql. In userdb sql you need to specify the user_query. You didn't give much information about your current setup that I'd assume is already working without working quota. http://wiki2.dovecot.org/AuthDatabase/SQL anyway has information about user_query (you can ignore the password_query).
On Wed, 2011-03-16 at 11:38 +0100, iti@promax.media.pl wrote:
I got problem with setting quota from mysql for local users. In database are only information with quota. Password are store in passwd/shadow.
You mean you only want quota limits to be listed in SQL, right? Then you don't need to use dict quota at all (or especially not sql dict).
Yes, only information in sql should be about quota. E.g my table is:
Select * from quota;
+---------------------------+-------+----------+ | username | bytes | messages | +---------------------------+-------+----------+ | user@test com | 3000 | 1000 | +---------------------------+-------+----------+
All other information are now sourced from PAM ( users info, passwords etc.). Is that possible to deliver some information about user as it is now (PAM) and only quota information in sql table?
So what you need to use is passdb pam and userdb sql. In userdb sql you need to specify the user_query. You didn't give much information about your current setup that I'd assume is already working without working quota. http://wiki2.dovecot.org/AuthDatabase/SQL anyway has information about user_query (you can ignore the password_query).
You mean:
userdb sql { args = /etc/dovecot/dovecot-sql.conf }
How should look like sql query in dovecot-sql.conf for table above ?
regards,
On Thu, 2011-03-17 at 09:07 +0100, iti@promax.media.pl wrote:
All other information are now sourced from PAM ( users info, passwords etc.).
PAM has only passwords. User info (uid, gid, home) is in passwd.
Is that possible to deliver some information about user as it is now (PAM) and only quota information in sql table?
If you want to merge multiple userdbs (passwd, sql) into one response then no, that's not directly possible. I guess your possibilities are:
a) Write a checkpassword script to do that and use userdb checkpassword.
b) Sync/merge the information into a single location (passwd-file or sql)
participants (2)
-
iti@promax.media.pl
-
Timo Sirainen