Return extra fields from passwd userdb
Michele Petrella
petrella at AFASystems.it
Fri Jul 7 19:16:03 EEST 2017
Hi all.
I use dovecot 2.2.29.1.
Output of dovecot -n:
# 2.2.29.1 (e0b76e3): /var/etc/dovecot/dovecot.conf
# Pigeonhole version 0.4.18 (29cc74d)
# OS: Linux 3.10.55-gentoo i686 SuSE Linux 7.1 (i386)
debug_log_path = /var/log/dovecot/dovecot_debug.log
disable_plaintext_auth = no
info_log_path = /var/log/state.mail/dovecot.pipe
log_path = /var/log/dovecot/dovecot.log
mail_debug = yes
mail_gid = users
mail_location = maildir:~/.maildir
mail_plugins = acl quota
mail_shared_explicit_inbox = yes
mail_uid = vmail
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 index ihave duplicate mime foreverypart extracttext
namespace {
list = yes
location = maildir:/data/home/vmail/public
prefix = Public/
separator = /
subscriptions = no
type = public
}
namespace {
list = children
location = maildir:/data/home/%%n/.maildir:INDEX=~/.maildir/shared/%%u
prefix = Shared/%%u/
separator = /
subscriptions = no
type = shared
}
namespace inbox {
inbox = yes
list = yes
location =
mailbox Cestino {
special_use = \Trash
}
mailbox Drafts {
special_use = \Drafts
}
mailbox Junk {
special_use = \Junk
}
mailbox "Posta inviata" {
special_use = \Sent
}
mailbox Sent {
special_use = \Sent
}
mailbox "Sent Messages" {
special_use = \Sent
}
mailbox Trash {
special_use = \Trash
}
prefix =
separator = /
subscriptions = yes
type = private
}
passdb {
args = /etc/dovecot/passwd.masterusers
driver = passwd-file
master = yes
}
passdb {
driver = pam
}
plugin {
acl = vfile:/etc/dovecot/acl:cache_secs=300
acl_shared_dict = file:/var/lib/dovecot-dict/shared-mailboxes
quota = maildir:User quota
quota_rule = *:storage=5M
quota_rule2 = Trash:storage=+100M
quota_rule3 = SPAM:ignore
sieve = ~/.dovecot.sieve
sieve_before = /var/etc/dovecot/sieve/general/
sieve_dir = ~/sieve
sieve_execute_bin_dir = /usr/local/bin/dovecot/sieve-execute
sieve_filter_bin_dir = /usr/local/bin/dovecot/sieve-filter
sieve_global_dir = /var/etc/dovecot/sieve/global/
sieve_global_extensions = +vnd.dovecot.execute +vnd.dovecot.filter
+vnd.dovecot.pipe +editheader
sieve_pipe_bin_dir = /usr/local/bin/dovecot/sieve-pipe
sieve_plugins = sieve_extprograms
}
protocols = imap pop3 lmtp sieve
service auth {
unix_listener auth-userdb {
group = users
}
}
service imap-postlogin {
executable = script-login /usr/local/bin/imap-postlogin.sh
user = $default_internal_user
}
service imap {
executable = imap imap-postlogin
}
ssl = no
ssl_cert = </conf/etc/cert/certs/services/imap_pop/majornet.crt
ssl_key = # hidden, use -P to show it
userdb {
default_fields = quota_rule=*:bytes=%$
driver = passwd
}
protocol lda {
info_log_path = /var/log/dovecot/dovecot-lda.log
log_path = /var/log/dovecot/dovecot-lda.log
mail_plugins = acl quota sieve
}
protocol imap {
mail_max_userip_connections = 20
mail_plugins = acl quota imap_acl imap_quota
}
I have problems in return extra fields from passwd userdb. My users are
partially in passwd files and partially in LDAP. Users who use mail are
in LDAP db.
If I use "default_fields = quota_rule=*:bytes=100M" in userdb,
Output of "doveadm -D quota get -u afasystems" is:
Debug: Loading modules from directory: /usr/lib/dovecot
Debug: Module loaded: /usr/lib/dovecot/lib01_acl_plugin.so
Debug: Module loaded: /usr/lib/dovecot/lib10_quota_plugin.so
Debug: Loading modules from directory: /usr/lib/dovecot/doveadm
Debug: Module loaded: /usr/lib/dovecot/doveadm/lib10_doveadm_acl_plugin.so
Debug: Skipping module doveadm_expire_plugin, because dlopen() failed:
/usr/lib/dovecot/doveadm/lib10_doveadm_expire_plugin.so: undefined
symbol: expire_set_deinit (this is usually intentional, so just ignore
this message)
Debug: Module loaded: /usr/lib/dovecot/doveadm/lib10_doveadm_quota_plugin.so
Debug: Module loaded: /usr/lib/dovecot/doveadm/lib10_doveadm_sieve_plugin.so
Debug: Skipping module doveadm_fts_lucene_plugin, because dlopen()
failed: /usr/lib/dovecot/doveadm/lib20_doveadm_fts_lucene_plugin.so:
undefined symbol: lucene_index_iter_deinit (this is usually intentional,
so just ignore this message)
Debug: Skipping module doveadm_fts_plugin, because dlopen() failed:
/usr/lib/dovecot/doveadm/lib20_doveadm_fts_plugin.so: undefined symbol:
fts_user_get_language_list (this is usually intentional, so just ignore
this message)
Debug: Skipping module doveadm_mail_crypt_plugin, because dlopen()
failed: /usr/lib/dovecot/doveadm/libdoveadm_mail_crypt_plugin.so:
undefined symbol: mail_crypt_box_get_pvt_digests (this is usually
intentional, so just ignore this message)
doveadm(afasystems): Debug: auth USER input: afasystems
quota_rule=*:bytes=100M system_groups_user=afasystems uid=1002 gid=100
home=/data/home/afasystems
doveadm(afasystems): Debug: Added userdb setting:
plugin/quota_rule=*:bytes=100M
doveadm(afasystems): Debug: Effective uid=1002, gid=100,
home=/data/home/afasystems
doveadm(afasystems): Debug: Quota root: name=User quota backend=maildir
args=
doveadm(afasystems): Debug: Quota rule: root=User quota mailbox=*
bytes=104857600 messages=0
doveadm(afasystems): Debug: Quota rule: root=User quota mailbox=Trash
bytes=+104857600 messages=0
doveadm(afasystems): Debug: Quota rule: root=User quota mailbox=SPAM ignored
doveadm(afasystems): Debug: Quota grace: root=User quota bytes=10485760
(10%)
doveadm(afasystems): Debug: Namespace inbox: type=private, prefix=,
sep=/, inbox=yes, hidden=no, list=yes, subscriptions=yes
location=maildir:~/.maildir
doveadm(afasystems): Debug: maildir++:
root=/data/home/afasystems/.maildir, index=, indexpvt=, control=,
inbox=/data/home/afasystems/.maildir, alt=
doveadm(afasystems): Debug: acl: initializing backend with data:
vfile:/etc/dovecot/acl:cache_secs=300
doveadm(afasystems): Debug: acl: acl username = afasystems
doveadm(afasystems): Debug: acl: owner = 1
doveadm(afasystems): Debug: acl vfile: Global ACL legacy directory:
/etc/dovecot/acl
doveadm(afasystems): Debug: Namespace : type=public, prefix=Public/,
sep=/, inbox=no, hidden=no, list=yes, subscriptions=no
location=maildir:/data/home/vmail/public
doveadm(afasystems): Debug: maildir++: root=/data/home/vmail/public,
index=, indexpvt=, control=, inbox=, alt=
doveadm(afasystems): Debug: acl: initializing backend with data:
vfile:/etc/dovecot/acl:cache_secs=300
doveadm(afasystems): Debug: acl: acl username = afasystems
doveadm(afasystems): Debug: acl: owner = 0
doveadm(afasystems): Debug: acl vfile: Global ACL legacy directory:
/etc/dovecot/acl
doveadm(afasystems): Debug: Namespace : type=shared, prefix=Shared/%u/,
sep=/, inbox=no, hidden=no, list=children, subscriptions=no
location=maildir:/data/home/%n/.maildir:INDEX=~/.maildir/shared/%u
doveadm(afasystems): Debug: shared: root=/var/run/dovecot, index=,
indexpvt=, control=, inbox=, alt=
doveadm(afasystems): Debug: acl: initializing backend with data:
vfile:/etc/dovecot/acl:cache_secs=300
doveadm(afasystems): Debug: acl: acl username = afasystems
doveadm(afasystems): Debug: acl: owner = 0
doveadm(afasystems): Debug: acl vfile: Global ACL legacy directory:
/etc/dovecot/acl
doveadm(afasystems): Debug: quota: quota_over_flag check:
quota_over_script unset - skipping
doveadm(afasystems): Debug: Namespace : Using permissions from
/data/home/afasystems/.maildir: mode=0700 gid=default
Quota name Type Value Limit %
User quota STORAGE 469 102400 0
User quota MESSAGE 6 - 0
That's ok, but i want to return quota from quotaBytes userdb parameter
But if I use "default_fields = quota_rule=*:bytes=%$" in userdb,
Output of "doveadm -D quota get -u afasystems" is:
Debug: Loading modules from directory: /usr/lib/dovecot
Debug: Module loaded: /usr/lib/dovecot/lib01_acl_plugin.so
Debug: Module loaded: /usr/lib/dovecot/lib10_quota_plugin.so
Debug: Loading modules from directory: /usr/lib/dovecot/doveadm
Debug: Module loaded: /usr/lib/dovecot/doveadm/lib10_doveadm_acl_plugin.so
Debug: Skipping module doveadm_expire_plugin, because dlopen() failed:
/usr/lib/dovecot/doveadm/lib10_doveadm_expire_plugin.so: undefined
symbol: expire_set_deinit (this is usually intentional, so just ignore
this message)
Debug: Module loaded: /usr/lib/dovecot/doveadm/lib10_doveadm_quota_plugin.so
Debug: Module loaded: /usr/lib/dovecot/doveadm/lib10_doveadm_sieve_plugin.so
Debug: Skipping module doveadm_fts_lucene_plugin, because dlopen()
failed: /usr/lib/dovecot/doveadm/lib20_doveadm_fts_lucene_plugin.so:
undefined symbol: lucene_index_iter_deinit (this is usually intentional,
so just ignore this message)
Debug: Skipping module doveadm_fts_plugin, because dlopen() failed:
/usr/lib/dovecot/doveadm/lib20_doveadm_fts_plugin.so: undefined symbol:
fts_user_get_language_list (this is usually intentional, so just ignore
this message)
Debug: Skipping module doveadm_mail_crypt_plugin, because dlopen()
failed: /usr/lib/dovecot/doveadm/libdoveadm_mail_crypt_plugin.so:
undefined symbol: mail_crypt_box_get_pvt_digests (this is usually
intentional, so just ignore this message)
doveadm(afasystems): Debug: auth USER input: afasystems
quota_rule=*:bytes= system_groups_user=afasystems uid=1002 gid=100
home=/data/home/afasystems
doveadm(afasystems): Debug: Added userdb setting: plugin/quota_rule=*:bytes=
doveadm(afasystems): Debug: Effective uid=1002, gid=100,
home=/data/home/afasystems
doveadm(afasystems): Debug: Quota root: name=User quota backend=maildir
args=
doveadm(afasystems): Debug: Quota rule: root=User quota mailbox=*
bytes=0 messages=0
doveadm(afasystems): Error: User initialization failed: Failed to
initialize quota: Invalid quota root quota: Invalid rule *:bytes=:
Invalid bytes limit:
doveadm(afasystems): Error: User init failed
Quota name Type Value Limit
if I use "default_fields = quota_rule=*:bytes=%{userdb:quotabytes}" in
userdb,
Output of "doveadm -D quota get -u afasystems" is:
Debug: Loading modules from directory: /usr/lib/dovecot
Debug: Module loaded: /usr/lib/dovecot/lib01_acl_plugin.so
Debug: Module loaded: /usr/lib/dovecot/lib10_quota_plugin.so
Debug: Loading modules from directory: /usr/lib/dovecot/doveadm
Debug: Module loaded: /usr/lib/dovecot/doveadm/lib10_doveadm_acl_plugin.so
Debug: Skipping module doveadm_expire_plugin, because dlopen() failed:
/usr/lib/dovecot/doveadm/lib10_doveadm_expire_plugin.so: undefined
symbol: expire_set_deinit (this is usually intentional, so just ignore
this message)
Debug: Module loaded: /usr/lib/dovecot/doveadm/lib10_doveadm_quota_plugin.so
Debug: Module loaded: /usr/lib/dovecot/doveadm/lib10_doveadm_sieve_plugin.so
Debug: Skipping module doveadm_fts_lucene_plugin, because dlopen()
failed: /usr/lib/dovecot/doveadm/lib20_doveadm_fts_lucene_plugin.so:
undefined symbol: lucene_index_iter_deinit (this is usually intentional,
so just ignore this message)
Debug: Skipping module doveadm_fts_plugin, because dlopen() failed:
/usr/lib/dovecot/doveadm/lib20_doveadm_fts_plugin.so: undefined symbol:
fts_user_get_language_list (this is usually intentional, so just ignore
this message)
Debug: Skipping module doveadm_mail_crypt_plugin, because dlopen()
failed: /usr/lib/dovecot/doveadm/libdoveadm_mail_crypt_plugin.so:
undefined symbol: mail_crypt_box_get_pvt_digests (this is usually
intentional, so just ignore this message)
doveadm(afasystems): Debug: auth USER input: afasystems
quota_rule=*:bytes= system_groups_user=afasystems uid=1002 gid=100
home=/data/home/afasystems
doveadm(afasystems): Debug: Added userdb setting: plugin/quota_rule=*:bytes=
doveadm(afasystems): Debug: Effective uid=1002, gid=100,
home=/data/home/afasystems
doveadm(afasystems): Debug: Quota root: name=User quota backend=maildir
args=
doveadm(afasystems): Debug: Quota rule: root=User quota mailbox=*
bytes=0 messages=0
doveadm(afasystems): Error: User initialization failed: Failed to
initialize quota: Invalid quota root quota: Invalid rule *:bytes=:
Invalid bytes limit:
doveadm(afasystems): Error: User init failed
Quota name Type Value Limit
if I use "default_fields = quota_rule=*:bytes=%{ldap:quotabytes}" in userdb,
Output of "doveadm -D quota get -u afasystems" is:
Debug: Loading modules from directory: /usr/lib/dovecot
Debug: Module loaded: /usr/lib/dovecot/lib01_acl_plugin.so
Debug: Module loaded: /usr/lib/dovecot/lib10_quota_plugin.so
Debug: Loading modules from directory: /usr/lib/dovecot/doveadm
Debug: Module loaded: /usr/lib/dovecot/doveadm/lib10_doveadm_acl_plugin.so
Debug: Skipping module doveadm_expire_plugin, because dlopen() failed:
/usr/lib/dovecot/doveadm/lib10_doveadm_expire_plugin.so: undefined
symbol: expire_set_deinit (this is usually intentional, so just ignore
this message)
Debug: Module loaded: /usr/lib/dovecot/doveadm/lib10_doveadm_quota_plugin.so
Debug: Module loaded: /usr/lib/dovecot/doveadm/lib10_doveadm_sieve_plugin.so
Debug: Skipping module doveadm_fts_lucene_plugin, because dlopen()
failed: /usr/lib/dovecot/doveadm/lib20_doveadm_fts_lucene_plugin.so:
undefined symbol: lucene_index_iter_deinit (this is usually intentional,
so just ignore this message)
Debug: Skipping module doveadm_fts_plugin, because dlopen() failed:
/usr/lib/dovecot/doveadm/lib20_doveadm_fts_plugin.so: undefined symbol:
fts_user_get_language_list (this is usually intentional, so just ignore
this message)
Debug: Skipping module doveadm_mail_crypt_plugin, because dlopen()
failed: /usr/lib/dovecot/doveadm/libdoveadm_mail_crypt_plugin.so:
undefined symbol: mail_crypt_box_get_pvt_digests (this is usually
intentional, so just ignore this message)
doveadm(afasystems): Debug: auth USER input: afasystems
quota_rule=*:bytes=UNSUPPORTED_VARIABLE_ldap
system_groups_user=afasystems uid=1002 gid=100 home=/data/home/afasystems
doveadm(afasystems): Debug: Added userdb setting:
plugin/quota_rule=*:bytes=UNSUPPORTED_VARIABLE_ldap
doveadm(afasystems): Debug: Effective uid=1002, gid=100,
home=/data/home/afasystems
doveadm(afasystems): Debug: Quota root: name=User quota backend=maildir
args=
doveadm(afasystems): Debug: Quota rule: root=User quota mailbox=*
bytes=0 messages=0
doveadm(afasystems): Error: User initialization failed: Failed to
initialize quota: Invalid quota root quota: Invalid rule
*:bytes=UNSUPPORTED_VARIABLE_ldap: Invalid bytes limit:
UNSUPPORTED_VARIABLE_ldap
doveadm(afasystems): Error: User init failed
Quota name Type Value Limit
Where I am wrong? What is the correct configuration?
Thanks in advance
--
AFA Systems Srl
Via G.Pastore
Zona Industriale B
86039 Termoli (CB) - Italia
tel.: +39 0875 724104
fax.: +39 0875 726084
www.afasystems.it
More information about the dovecot
mailing list