[Dovecot] expire plugin doesn't find mail location

Roland Rosenfeld rrosenfeld at netcologne.de
Tue Jan 12 16:43:39 EET 2010


Hi!

After searching for hours now, I give up and have to ask here.  I try
to use the expire plugin but it always tries to expire my mails
instead of the mails of the user.

I read about the "Mail location setting problem (v1.1-v1.2) and
configured a "mail" extra field in the userdb, but that doesn't have
the effect I want.

I have not idea, what I could try out more, so I ask here.

My setup is the following:

# 1.2.9: /usr/local/dovecot/etc/dovecot.conf
# OS: SunOS 5.10 sun4v  zfs
syslog_facility: local6
protocols: imap pop3 managesieve
listen(default): *
listen(imap): *
listen(pop3): *
listen(managesieve): *:2000, *:4190
ssl: no
disable_plaintext_auth: no
login_dir: /usr/local/dovecot/var/run/dovecot/login
login_executable(default): /usr/local/dovecot/libexec/dovecot/imap-login
login_executable(imap): /usr/local/dovecot/libexec/dovecot/imap-login
login_executable(pop3): /usr/local/dovecot/libexec/dovecot/pop3-login
login_executable(managesieve): /usr/local/dovecot/libexec/dovecot/managesieve-login
mail_uid: 2001
mail_gid: 2001
mail_location: maildir:/var/mailstore/%2Mn/%n/mail
mail_debug: yes
mail_executable(default): /usr/local/dovecot/libexec/dovecot/imap
mail_executable(imap): /usr/local/dovecot/libexec/dovecot/imap
mail_executable(pop3): /usr/local/dovecot/libexec/dovecot/pop3
mail_executable(managesieve): /usr/local/dovecot/libexec/dovecot/managesieve
mail_plugins(default): quota imap_quota expire
mail_plugins(imap): quota imap_quota expire
mail_plugins(pop3): quota expire
mail_plugins(managesieve): 
mail_plugin_dir(default): /usr/local/dovecot/lib/dovecot/imap
mail_plugin_dir(imap): /usr/local/dovecot/lib/dovecot/imap
mail_plugin_dir(pop3): /usr/local/dovecot/lib/dovecot/pop3
mail_plugin_dir(managesieve): /usr/local/dovecot/lib/dovecot/managesieve
pop3_uidl_format(default): %08Xu%08Xv
pop3_uidl_format(imap): %08Xu%08Xv
pop3_uidl_format(pop3): %v.%u
pop3_uidl_format(managesieve): %08Xu%08Xv
namespace:
  type: private
  separator: /
  inbox: yes
  list: yes
  subscriptions: yes
lda:
  postmaster_address: postmaster at netcologne.de
  hostname: mailstore20.netcologne.de
  mail_plugins: sieve quota expire
  auth_socket_path: /usr/local/dovecot/var/run/dovecot/auth-master
auth default:
  master_user_separator: *
  verbose: yes
  debug: yes
  passdb:
    driver: passwd-file
    args: /usr/local/dovecot/etc/passwd.master
    pass: yes
    master: yes
  passdb:
    driver: sql
    args: /usr/local/dovecot/etc/dovecot-sql.conf
  userdb:
    driver: prefetch
  userdb:
    driver: sql
    args: /usr/local/dovecot/etc/dovecot-sql.conf
  socket:
    type: listen
    master:
      path: /usr/local/dovecot/var/run/dovecot/auth-master
      mode: 384
      user: vmail
plugin:
  quota: maildir
  expire: INBOX 60 Spam 60 Papierkorb 60 Trash 1
  expire_dict: proxy::expire
dict:
  expire: mysql:/usr/local/dovecot/etc/dovecot-dict-expire.conf


With the following dovecot-sql.conf:

driver = mysql
connect = host=localhost dbname=cyrus user=cyrus password=XXXX
default_pass_scheme = CRYPT
password_query = \
   SELECT username, password, concat('*:storage=', quota) AS userdb_quota_rule, '/var/mailstore/%2Mn/%n' as userdb_home, 'maildir:/var/mailstore/%2Mn/%n/mail' as userdb_mail \
   FROM passwd WHERE username='%n'
user_query = \
  SELECT concat('*:storage=', quota) AS quota_rule, '/var/mailstore/%2Mn/%n' as home, 'maildir:/var/mailstore/%2Mn/%n/mail' as mail \
  FROM passwd WHERE username='%n'



And this is dovecot-dict-expire.conf:

connect = host=localhost dbname=dovecot user=dovecot password=XXXXXX
map {
  pattern = shared/expire/$user/$mailbox
  table = expires
  value_field = expire_stamp
  fields {
    username = $user
    mailbox = $mailbox
  }
}


In user test's Trash folder there are mails that are older than 1 day
and in dovecot.expires there is 
+----------+---------+--------------+
| username | mailbox | expire_stamp |
+----------+---------+--------------+
| test     | Trash   |   1262779049 |
+----------+---------+--------------+


But if I run 
/usr/local/dovecot/sbin/dovecot --exec-mail ext /usr/local/dovecot/libexec/dovecot/expire-tool.sh --test

I get the following output:

Info: Loading modules from directory: /usr/local/dovecot/lib/dovecot/imap
Info: Module loaded: /usr/local/dovecot/lib/dovecot/imap/lib10_quota_plugin.so
Info: Module loaded: /usr/local/dovecot/lib/dovecot/imap/lib20_expire_plugin.so
Info: Quota root: name= backend=maildir args=
Info: expire: pattern=INBOX type=expunge secs=5184000
Info: expire: pattern=Spam type=expunge secs=5184000
Info: expire: pattern=Papierkorb type=expunge secs=5184000
Info: expire: pattern=Trash type=expunge secs=86400
Info: auth input: quota_rule=*:storage=10000
Info: auth input: home=/var/mailstore/09/test
Info: auth input: mail=maildir:/var/mailstore/09/test/mail
Info: Namespace: type=private, prefix=, sep=/, inbox=yes, hidden=no, list=yes, subscriptions=yes
Info: maildir: data=/var/mailstore/df/rrosenfeld/mail
Info: maildir++: root=/var/mailstore/df/rrosenfeld/mail, index=, control=, inbox=/var/mailstore/df/rrosenfeld/mail
Info: test/Trash: no messages left
Info: test/Spam: stop, expire time in future: Sat Mar  6 12:35:10 2010

As you can see, it uses my username (rrosenfeld) instead of the
username "test", whose mailbox should be expired.  But while the above
it printed to the console I get the following in the logfile:

Jan 12 15:33:54 mailstore20 dovecot: [ID 583609 local6.info] dict: mysql: Connected to localhost (dovecot)
Jan 12 15:33:54 mailstore20 dovecot: [ID 583609 local6.info] auth(default): master in: USER     1       test    service=internal
Jan 12 15:33:54 mailstore20 dovecot: [ID 583609 local6.info] auth(default): prefetch(test): passdb didn't return userdb entries, trying the next userdb
Jan 12 15:33:54 mailstore20 dovecot: [ID 583609 local6.info] auth-worker(default): sql(test): SELECT concat('*:storage=', quota) AS quota_rule, '/var/mailstore/09/test' as home, 'maildir:/var/mailstore/09/test/mail' as mail FROM passwd WHERE username='test'
Jan 12 15:33:54 mailstore20 dovecot: [ID 583609 local6.info] auth-worker(default): mysql: Connected to localhost (cyrus)
Jan 12 15:33:54 mailstore20 dovecot: [ID 583609 local6.info] auth(default): master out: USER    1       test    quota_rule=*:storage=10000      home=/var/mailstore/09/test     mail=maildir:/var/mailstore/09/test/mail

As you can see, the auth engine sees the request for the user "test".
It also returns the correct home and mail attributes (the above
messages were triggered by my expire call!).


I tried out to comment out the mail_location from dovecot.conf to make
sure that the mail attribute from userdb is used, but this has the
effect, that dovecot expire does not know any mail location setting at
all and tries some "home" directories and different mail storage
formats while my setting mail=maildir:/var/mailstore/09/test/mail from
the userdb is completely ignored:

Info: Loading modules from directory: /usr/local/dovecot/lib/dovecot/imap
Info: Module loaded: /usr/local/dovecot/lib/dovecot/imap/lib10_quota_plugin.so
Info: Module loaded: /usr/local/dovecot/lib/dovecot/imap/lib20_expire_plugin.so
Info: Quota root: name= backend=maildir args=
Info: expire: pattern=INBOX type=expunge secs=5184000
Info: expire: pattern=Spam type=expunge secs=5184000
Info: expire: pattern=Papierkorb type=expunge secs=5184000
Info: expire: pattern=Trash type=expunge secs=86400
Info: auth input: quota_rule=*:storage=10000
Info: auth input: home=/var/mailstore/09/test
Info: auth input: mail=maildir:/var/mailstore/09/test/mail
Info: Namespace: type=private, prefix=, sep=/, inbox=yes, hidden=no, list=yes, subscriptions=yes
Info: cydir: mailbox location not given
Info: cydir: Couldn't create mail storage : Root mail directory not given
Info: dbox: mailbox location not given
Info: dbox: Couldn't create mail storage : Root mail directory not given
Info: maildir: access(/var/mailstore/09/test/Maildir, rwx): failed: No such file or directory
Info: maildir: couldn't find root dir
Info: maildir: Couldn't create mail storage : Root mail directory not given
Info: mbox: root exists (/var/mailstore/09/test/mail)
Info: mbox: INBOX: access(/var/mail/test, rw) failed: No such file or directory
Info: mbox: INBOX: access(/var/spool/mail/test, rw) failed: No such file or directory
Info: mbox: INBOX defaulted to /var/mailstore/09/test/mail/inbox
Info: fs: root=/var/mailstore/09/test/mail, index=, control=, inbox=/var/mailstore/09/test/mail/inbox
Info: test/Trash: no messages left
Info: test/Spam: stop, expire time in future: Sat Mar  6 12:35:10 2010

As you can see, expire tries to access different (default?) mailbox
typies instead of simply using maildir:/var/mailstore/09/test/mail as
defined in the userdb.

So my main problem seems to be, that the mail attribute from the
userdb is completely ignored in expire calls.  But how do I fix this?

Tschoeeee

        Roland

-- 
Roland Rosenfeld  -  Content Delivery  -  NED  -  Technik
NetCologne Gesellschaft für Telekommunikation mbH  -  HRB 25580, AG Köln
Am Coloneum 9   50829 Köln   Tel.: +49-221-2222-373   Fax: +49-221-2222-7373
Geschäftsführer: Werner Hanf, Karl-Heinz Zankel


More information about the dovecot mailing list