User database extra fields
A user database lookup typically returns [:UserDatabase:uid, gid, home and mail] fields. Other possibilities are:
nice: Set the mail process's priority to be the given value.
chroot: Chroot to given directory. Overrides mail_chroot setting in dovecot.conf.
system_user: If this is given, the user's groups are read from /etc/group (or wherever NSS is configured to taken them from).
It's possible to override settings from dovecot.conf.
Most commonly settings are overridden from plugin section. For example if your plugin section has quota=maildir:storage=1024 value and the userdb lookup returns quota=maildir:storage=2048, the original quota setting gets overridden. In fact if the lookup always returns a quota field, there's no point in having the quota setting in plugin section at all, because it always gets overridden anyway.
To understand how imap and pop3 processes see their settings, it may be helpful to know how Dovecot internally passes them:
- All actual settings are first placed into environment variables. The environment name may be different than the setting name.
Everything inside plugin section is placed into environment variables. [:Variables:%variables] in values are expanded first.
- Everything from userdb lookup is placed into environment variables.
At this point if [:PostLoginScripting:post-login scripting is used], it may modify the environment if wanted.
- imap/pop3 reads the settings from environment variables. It doesn't matter how they got there, they're read the exact same way.
At each step if the environment variable already exists, it's replaced with the new value (ie. the setting is overridden).
If you want to override a setting from userdb you must use its environment name, not the setting name. See PostLoginScripting for how to find out what the environment is named.
Boolean settings are checked simply by the environment variables' existence and their values are ignored. For example having a userdb lookup return mmap_disable=no would still enable it.
# NOTE: \ line splitting works only with v1.1 user_query = SELECT home, uid, gid, \ 'quota=maildir:storage=1024' as quota, mail_plugins \ FROM users WHERE userid = '%u'
user_attrs = homeDirectory=home,uidNumber=uid,gidNumber=gid,quotaDovecot=quota,mail_plugins