[Dovecot] Combining userdbs
Bubreg István
bubreg.istvan at gmail.com
Sun Jun 1 19:58:15 UTC 2014
Hi,
I think that using more than one userdb with setting the result
actions doesn't work as expected from the documentation.
The goal would be to set user-specific quotas for a few users with a
specific passwd-file like this :
cat /etc/dovecot/quotas
foo:x::::::userdb_quota_rule=*:storage=2G
The first userdb is passwd (with pam passwd):
userdb {
driver = passwd
result_failure = return-fail
result_internalfail = return-fail
result_success = continue-ok
skip = never
}
The second one is for the specific quota
userdb {
args = username_format=%n /etc/dovecot/quotas
driver = passwd-file
result_failure = continue
result_internalfail = continue
result_success = return-ok
skip = notfound
}
User 'foo' exists in (pam) passd, but there's no place to store his own
quota rule, that's why came handy to use a second userdb for storing just
one extra field.
That's working quiet well, he default quota is overriding form passwd-file.
BUT:
I've played a lot with changing the result_* and the 'skip' parameters, but
none of them worked in the situation where a user ('bar') _only_ exists in
passwd (and has to use the default quota config).
doveadm quota get -u bar
says
doveadm(bar): Fatal: User doesn't exist
With changing the parameters this error has gone, but the second userdb
doesn't used for user 'foo' - even if the parameters are :
userdb {
driver = passwd
result_failure = return-fail
result_internalfail = return-fail
result_success = continue <-- in theory, the next
userdb is coming
skip = never
}
userdb {
args = username_format=%n /etc/dovecot/quotas
driver = passwd-file
result_failure = continue
result_internalfail = continue
result_success = return-ok
skip = notfound
}
My question is that how should i set the result_* and 'skip' parameters to
solve this :
- there's a default quota rule in the config
- some (a few) users has a larger quota
- there's no way to store the user-specific quotas in the 'real' userdb
(because it's pam/passwd)
Thank you for your effort.
# dovecot -n
# 2.2.13 (de9b10f2e168): /etc/dovecot/dovecot.conf
# OS: Linux 3.11.0-15-generic i686 Ubuntu 12.04.4 LTS
auth_debug = yes
auth_debug_passwords = yes
auth_verbose = yes
auth_verbose_passwords = yes
disable_plaintext_auth = no
listen = *
log_path = /var/log/dovecot.log
mail_debug = yes
mail_location = maildir:~/Maildir
mail_plugins = " quota"
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope encoded-character
vacation subaddress comparator-i;ascii-numeric relational regex imap4flags
copy include variables body enotify environment mailbox date ihave duplicate
namespace inbox {
inbox = yes
location =
mailbox Drafts {
special_use = \Drafts
}
mailbox Junk {
special_use = \Junk
}
mailbox Sent {
special_use = \Sent
}
mailbox "Sent Messages" {
special_use = \Sent
}
mailbox Trash {
special_use = \Trash
}
prefix =
}
passdb {
driver = pam
}
plugin {
quota = maildir:User quota
quota_rule = *:storage=1G
quota_rule2 = Trash:storage=+100M
sieve = ~/.dovecot.sieve
sieve_dir = ~/sieve
}
protocols = " imap sieve"
service managesieve-login {
inet_listener sieve {
port = 4190
}
}
service managesieve {
process_limit = 1024
}
ssl = no
ssl_cert = </etc/dovecot/private/dovecot.pem
ssl_key = </etc/dovecot/private/dovecot.pem
userdb {
driver = passwd
result_failure = return-fail
result_internalfail = return-fail
result_success = continue-ok
}
userdb {
args = username_format=%n /etc/dovecot/quotas
driver = passwd-file
result_failure = continue-ok
result_internalfail = continue-ok
skip = notfound
}
protocol imap {
mail_plugins = quota
}
More information about the dovecot
mailing list