[Dovecot] expire plugin doesn't work?
Hello, I've configured dovecot to use expire plugin: heres my dovecot -n:
# 2.1.7: /etc/dovecot/dovecot.conf # OS: Linux 3.2.0-4-amd64 x86_64 Debian 7.1 ext4 auth_mechanisms = plain login dict { expire = mysql:/etc/dovecot/dovecot-dict-expire-sql.conf.ext } mail_location = maildir:/home/mail/vhosts/%d/%n mail_plugins = expire mail_privileged_group = 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 ihave namespace inbox { inbox = yes location = mailbox Drafts { auto = no special_use = \Drafts } mailbox Junk { special_use = \Junk } mailbox Sent { auto = subscribe special_use = \Sent } mailbox "Sent Messages" { special_use = \Sent } mailbox Spam { auto = subscribe special_use = \Junk } mailbox Trash { auto = subscribe special_use = \Trash } prefix = } passdb { args = /etc/dovecot/dovecot-sql.conf.ext driver = sql } plugin { expire = Trash 7 expire_dict = proxy::expire sieve = ~/dovecot.sieve sieve_dir = ~/sieve sieve_max_actions = 32 sieve_max_redirects = 4 sieve_max_script_size = 1M sieve_quota_max_scripts = 32 } protocols = imap pop3 lmtp sieve service auth-worker { user = vmail } service auth { unix_listener /var/spool/postfix/private/auth { group = postfix mode = 0666 user = postfix } unix_listener auth-userdb { mode = 0600 user = vmail } user = dovecot } service imap-login { inet_listener imap { port = 0 } inet_listener imaps { port = 993 ssl = yes } } service lmtp { unix_listener /var/spool/postfix/private/dovecot-lmtp { group = postfix mode = 0600 user = postfix } } service managesieve-login { inet_listener sieve { port = 4190 } service_count = 1 vsz_limit = 128 M } service pop3-login { inet_listener pop3 { port = 0 } inet_listener pop3s { port = 995 ssl = yes } } ssl = required ssl_ca =
What exactly I did....
dovecot.conf dict { expire = mysql:/etc/dovecot/dovecot-dict-expire-sql.conf.ext }
/etc/dovecot/dovecot-dict-expire-sql.conf.ext connect = host=127.0.0.1 dbname=mailserver user=mail password=SOMEPASS
map { pattern = shared/expire/$user/$mailbox table = expires value_field = expire_stamp
fields { username = $user mailbox = $mailbox } }
conf.d/10-mail.conf mail_plugins = expire
conf.d/90-plugin.conf plugin { #setting_name = value expire = Trash 7 expire_dict = proxy::expire }
Created table in mysql server mysql> show create table expires; +---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Table | Create Table | +---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | expires | CREATE TABLE
expires
(username
varchar(75) NOT NULL,mailbox
varchar(255) NOT NULL,expire_stamp
int(11) NOT NULL, PRIMARY KEY (username
,mailbox
)ENGINE=InnoDB DEFAULT CHARSET=utf8 | +---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec)
And nothing works dovecot debug shows nothing: only one string related to expire plugin Aug 24 04:21:37 piscola dovecot: lmtp(16927): Debug: Module loaded: /usr/lib/dovecot/modules/lib20_expire_plugin.so
mysql general query log show nothing also...
Can anyone help me please? Thanks a lot!
On 08/23/2013 09:05 PM, Anton Chigin wrote:
plugin { expire = Trash 7 expire_dict = proxy::expire
You're using Dovecot 2.1, that configuration syntax is for 1.2. Please follow documentation at http://wiki2.dovecot.org/Plugins/Expire
Hi!Thanks for your suggestion, that moved me in to right direction.It was double permission issue, that I was able to debug since changed format, and now timestaps are added into the mysql table. As far as I understand expire plugin only adds timestamps to mysql table, and thats it, isn't it?I mean I want to understand how to configure mails to be removed...Do I need to add to cron "doveadm expunge -A mailbox Trash savedbefore 30d" ? Thanks a lot!
Date: Fri, 23 Aug 2013 21:17:34 -0400 From: gedalya@gedalya.net To: dovecot@dovecot.org; anton.chigin@live.com Subject: Re: [Dovecot] expire plugin doesn't work?
On 08/23/2013 09:05 PM, Anton Chigin wrote:
plugin { expire = Trash 7 expire_dict = proxy::expire
You're using Dovecot 2.1, that configuration syntax is for 1.2. Please follow documentation at http://wiki2.dovecot.org/Plugins/Expire
Yes, you add that cron job, and it would work with or without the expire plugin. The thing is that if the expire plugin is enabled, the "doveadm expunge" command will look at the expires table in mysql and only process users who are in the database with a timestamp older than your specified message age. The timestamp is supposed to designate "age of oldest message in folder". Without the expires plugin, the command would have to process every user in the system (as per the result of the iterate query, if you're using SQL authentication) and actually open every Trash folder and look inside, which would normally be a lot more work and take more time.
On 08/24/2013 06:16 AM, Anton Chigin wrote:
Hi! Thanks for your suggestion, that moved me in to right direction. It was double permission issue, that I was able to debug since changed format, and now timestaps are added into the mysql table.
As far as I understand expire plugin only adds timestamps to mysql table, and thats it, isn't it? I mean I want to understand how to configure mails to be removed... Do I need to add to cron "doveadm expunge -A mailbox Trash savedbefore 30d" ?
Thanks a lot!
Date: Fri, 23 Aug 2013 21:17:34 -0400 From: gedalya@gedalya.net To: dovecot@dovecot.org; anton.chigin@live.com Subject: Re: [Dovecot] expire plugin doesn't work?
On 08/23/2013 09:05 PM, Anton Chigin wrote:
plugin { expire = Trash 7 expire_dict = proxy::expire
You're using Dovecot 2.1, that configuration syntax is for 1.2. Please follow documentation at http://wiki2.dovecot.org/Plugins/Expire
So,is enabling expire plugin the only way "doveadm expunge" to work with static userdb, because of lack iterate_query option? If I test it now "doveadm search" I see:Aug 24 13:28:22 piscola dovecot: auth: Debug: Loading modules from directory: /usr/lib/dovecot/modules/authAug 24 13:28:22 piscola dovecot: auth: Debug: Module loaded: /usr/lib/dovecot/modules/auth/libdriver_mysql.soAug 24 13:28:22 piscola dovecot: auth: Debug: master in: LIST#0111Aug 24 13:28:22 piscola dovecot: auth: Error: Trying to iterate users, but userdbs don't support it userdb I have:userdb { args = uid=vmail gid=vmail home=/home/mail/vhosts/%d/%n driver = static} Is it OK and doveadm will not have to iterate users since expire plugin is enabled?Or should I still fix it to get it works properly? Thanks a lot for your help! Date: Sat, 24 Aug 2013 06:22:32 -0400 From: gedalya@gedalya.net To: anton.chigin@live.com CC: dovecot@dovecot.org Subject: Re: [Dovecot] expire plugin doesn't work?
Yes, you add that cron job, and it
would work with or without the expire plugin.
The thing is that if the expire plugin is enabled, the "doveadm
expunge" command will look at the expires table in mysql and only
process users who are in the database with a timestamp older than
your specified message age. The timestamp is supposed to designate
"age of oldest message in folder". Without the expires plugin, the
command would have to process every user in the system (as per the
result of the iterate query, if you're using SQL authentication)
and actually open every Trash folder and look inside, which would
normally be a lot more work and take more time.
On 08/24/2013 06:16 AM, Anton Chigin wrote:
Hi!
Thanks for your suggestion, that moved me in to right
direction.
It was double permission issue, that I was able to debug
since changed format, and now timestaps are added into the
mysql table.
As far as I understand expire plugin only adds timestamps
to mysql table, and thats it, isn't it?
I mean I want to understand how to configure mails to be
removed...
Do I need to add to cron "doveadm expunge -A
mailbox Trash savedbefore 30d" ?
Thanks a lot!
> Date: Fri, 23 Aug 2013 21:17:34 -0400
> From: gedalya@gedalya.net
> To: dovecot@dovecot.org; anton.chigin@live.com
> Subject: Re: [Dovecot] expire plugin doesn't work?
>
> On 08/23/2013 09:05 PM, Anton Chigin wrote:
> > plugin {
> > expire = Trash 7
> > expire_dict = proxy::expire
>
> You're using Dovecot 2.1, that configuration syntax is
for 1.2.
> Please follow documentation at
http://wiki2.dovecot.org/Plugins/Expire
>
I don't know, why don't you just try? If you run the exact same command but with "search" instead of "expunge", it should also use the expire plugin in the same way, so that should be an easy test. Are you using sql for passdb? If so I wonder if you could define an sql userdb in addition to the static userdb with only an iterate_query defined..?
On 08/24/2013 06:46 AM, Anton Chigin wrote:
So, is enabling expire plugin the only way "doveadm expunge" to work with static userdb, because of lack iterate_query option?
If I test it now "doveadm search" I see: Aug 24 13:28:22 piscola dovecot: auth: Debug: Loading modules from directory: /usr/lib/dovecot/modules/auth Aug 24 13:28:22 piscola dovecot: auth: Debug: Module loaded: /usr/lib/dovecot/modules/auth/libdriver_mysql.so Aug 24 13:28:22 piscola dovecot: auth: Debug: master in: LIST#0111 Aug 24 13:28:22 piscola dovecot: auth: Error: Trying to iterate users, but userdbs don't support it
userdb I have: userdb { args = uid=vmail gid=vmail home=/home/mail/vhosts/%d/%n driver = static }
Is it OK and doveadm will not have to iterate users since expire plugin is enabled? Or should I still fix it to get it works properly?
Thanks a lot for your help!
Date: Sat, 24 Aug 2013 06:22:32 -0400 From: gedalya@gedalya.net To: anton.chigin@live.com CC: dovecot@dovecot.org Subject: Re: [Dovecot] expire plugin doesn't work?
Yes, you add that cron job, and it would work with or without the expire plugin. The thing is that if the expire plugin is enabled, the "doveadm expunge" command will look at the expires table in mysql and only process users who are in the database with a timestamp older than your specified message age. The timestamp is supposed to designate "age of oldest message in folder". Without the expires plugin, the command would have to process every user in the system (as per the result of the iterate query, if you're using SQL authentication) and actually open every Trash folder and look inside, which would normally be a lot more work and take more time.
On 08/24/2013 06:16 AM, Anton Chigin wrote:
Hi! Thanks for your suggestion, that moved me in to right direction. It was double permission issue, that I was able to debug since changed format, and now timestaps are added into the mysql table. As far as I understand expire plugin only adds timestamps to mysql table, and thats it, isn't it? I mean I want to understand how to configure mails to be removed... Do I need to add to cron "doveadm expunge -A mailbox Trash savedbefore 30d" ? Thanks a lot! > Date: Fri, 23 Aug 2013 21:17:34 -0400 > From: gedalya@gedalya.net <mailto:gedalya@gedalya.net> > To: dovecot@dovecot.org <mailto:dovecot@dovecot.org>; anton.chigin@live.com <mailto:anton.chigin@live.com> > Subject: Re: [Dovecot] expire plugin doesn't work? > > On 08/23/2013 09:05 PM, Anton Chigin wrote: > > plugin { > > expire = Trash 7 > > expire_dict = proxy::expire > > You're using Dovecot 2.1, that configuration syntax is for 1.2. > Please follow documentation at http://wiki2.dovecot.org/Plugins/Expire >
I've set up both static userdb and mysql userdb and according to mysql logs it works as you described!Will move from static to sql usersdb anyway. Thanks!
Date: Sat, 24 Aug 2013 06:57:05 -0400 From: gedalya@gedalya.net To: anton.chigin@live.com CC: dovecot@dovecot.org Subject: Re: [Dovecot] expire plugin doesn't work?
I don't know, why don't you just try?
If you run the exact same command but with "search" instead of
"expunge", it should also use the expire plugin in the same way,
so that should be an easy test.
Are you using sql for passdb? If so I wonder if you could define
an sql userdb in addition to the static userdb with only an
iterate_query defined..?
On 08/24/2013 06:46 AM, Anton Chigin wrote:
So,
is enabling expire plugin the only way "doveadm expunge" to
work with static userdb, because of lack iterate_query option?
If I test it now "doveadm search" I see:
Aug 24 13:28:22 piscola dovecot: auth: Debug: Loading
modules from directory: /usr/lib/dovecot/modules/auth
Aug 24 13:28:22 piscola dovecot: auth: Debug: Module
loaded: /usr/lib/dovecot/modules/auth/libdriver_mysql.so
Aug 24 13:28:22 piscola dovecot: auth: Debug: master in:
LIST#0111
Aug 24 13:28:22 piscola dovecot: auth: Error: Trying to
iterate users, but userdbs don't support it
userdb I have:
userdb {
args = uid=vmail gid=vmail
home=/home/mail/vhosts/%d/%n
driver = static
}
Is it OK and doveadm will not have to iterate users since
expire plugin is enabled?
Or should I still fix it to get it works properly?
Thanks a lot for your help!
Date: Sat, 24 Aug 2013 06:22:32 -0400
From: gedalya@gedalya.net
To: anton.chigin@live.com
CC: dovecot@dovecot.org
Subject: Re: [Dovecot] expire plugin doesn't work?
Yes, you add that cron job,
and it would work with or without the expire plugin.
The thing is that if the expire plugin is enabled, the
"doveadm expunge" command will look at the expires table
in mysql and only process users who are in the database
with a timestamp older than your specified message age.
The timestamp is supposed to designate "age of oldest
message in folder". Without the expires plugin, the
command would have to process every user in the system (as
per the result of the iterate query, if you're using SQL
authentication) and actually open every Trash folder and
look inside, which would normally be a lot more work and
take more time.
On 08/24/2013 06:16 AM, Anton Chigin wrote:
Hi!
Thanks for your suggestion, that moved me in to
right direction.
It was double permission issue, that I was able to
debug since changed format, and now timestaps are
added into the mysql table.
As far as I understand expire plugin only adds
timestamps to mysql table, and thats it, isn't it?
I mean I want to understand how to configure mails
to be removed...
Do I need to add to cron "doveadm
expunge -A mailbox Trash savedbefore 30d" ?
Thanks a lot!
> Date: Fri, 23 Aug 2013 21:17:34 -0400
> From: gedalya@gedalya.net
> To: dovecot@dovecot.org;
anton.chigin@live.com
> Subject: Re: [Dovecot] expire plugin doesn't
work?
>
> On 08/23/2013 09:05 PM, Anton Chigin wrote:
> > plugin {
> > expire = Trash 7
> > expire_dict = proxy::expire
>
> You're using Dovecot 2.1, that configuration
syntax is for 1.2.
> Please follow documentation at http://wiki2.dovecot.org/Plugins/Expire
>
Oh cool. Nice to hear. Remember to take a look at the prefetch http://wiki2.dovecot.org/UserDatabase/Prefetch , it saves you an extra query in cases where authentication took place before userdb lookup.
On 08/24/2013 07:19 AM, Anton Chigin wrote:
I've set up both static userdb and mysql userdb and according to mysql logs it works as you described! Will move from static to sql usersdb anyway. Thanks!
Date: Sat, 24 Aug 2013 06:57:05 -0400 From: gedalya@gedalya.net To: anton.chigin@live.com CC: dovecot@dovecot.org Subject: Re: [Dovecot] expire plugin doesn't work?
I don't know, why don't you just try? If you run the exact same command but with "search" instead of "expunge", it should also use the expire plugin in the same way, so that should be an easy test. Are you using sql for passdb? If so I wonder if you could define an sql userdb in addition to the static userdb with only an iterate_query defined..?
On 08/24/2013 06:46 AM, Anton Chigin wrote:
So, is enabling expire plugin the only way "doveadm expunge" to work with static userdb, because of lack iterate_query option? If I test it now "doveadm search" I see: Aug 24 13:28:22 piscola dovecot: auth: Debug: Loading modules from directory: /usr/lib/dovecot/modules/auth Aug 24 13:28:22 piscola dovecot: auth: Debug: Module loaded: /usr/lib/dovecot/modules/auth/libdriver_mysql.so Aug 24 13:28:22 piscola dovecot: auth: Debug: master in: LIST#0111 Aug 24 13:28:22 piscola dovecot: auth: Error: Trying to iterate users, but userdbs don't support it userdb I have: userdb { args = uid=vmail gid=vmail home=/home/mail/vhosts/%d/%n driver = static } Is it OK and doveadm will not have to iterate users since expire plugin is enabled? Or should I still fix it to get it works properly? Thanks a lot for your help! ------------------------------------------------------------------------ Date: Sat, 24 Aug 2013 06:22:32 -0400 From: gedalya@gedalya.net <mailto:gedalya@gedalya.net> To: anton.chigin@live.com <mailto:anton.chigin@live.com> CC: dovecot@dovecot.org <mailto:dovecot@dovecot.org> Subject: Re: [Dovecot] expire plugin doesn't work? Yes, you add that cron job, and it would work with or without the expire plugin. The thing is that if the expire plugin is enabled, the "doveadm expunge" command will look at the expires table in mysql and only process users who are in the database with a timestamp older than your specified message age. The timestamp is supposed to designate "age of oldest message in folder". Without the expires plugin, the command would have to process every user in the system (as per the result of the iterate query, if you're using SQL authentication) and actually open every Trash folder and look inside, which would normally be a lot more work and take more time. On 08/24/2013 06:16 AM, Anton Chigin wrote: Hi! Thanks for your suggestion, that moved me in to right direction. It was double permission issue, that I was able to debug since changed format, and now timestaps are added into the mysql table. As far as I understand expire plugin only adds timestamps to mysql table, and thats it, isn't it? I mean I want to understand how to configure mails to be removed... Do I need to add to cron "doveadm expunge -A mailbox Trash savedbefore 30d" ? Thanks a lot! > Date: Fri, 23 Aug 2013 21:17:34 -0400 > From: gedalya@gedalya.net <mailto:gedalya@gedalya.net> > To: dovecot@dovecot.org <mailto:dovecot@dovecot.org>; anton.chigin@live.com <mailto:anton.chigin@live.com> > Subject: Re: [Dovecot] expire plugin doesn't work? > > On 08/23/2013 09:05 PM, Anton Chigin wrote: > > plugin { > > expire = Trash 7 > > expire_dict = proxy::expire > > You're using Dovecot 2.1, that configuration syntax is for 1.2. > Please follow documentation at http://wiki2.dovecot.org/Plugins/Expire >
Was just reading the same wiki page :)Really appreciate your help.Will mark as resolved
Date: Sat, 24 Aug 2013 07:20:53 -0400 From: gedalya@gedalya.net To: anton.chigin@live.com CC: dovecot@dovecot.org Subject: Re: [Dovecot] expire plugin doesn't work?
Oh cool. Nice to hear.
Remember to take a look at the prefetch
http://wiki2.dovecot.org/UserDatabase/Prefetch , it saves you an
extra query in cases where authentication took place before userdb
lookup.
On 08/24/2013 07:19 AM, Anton Chigin wrote:
I've set up both static userdb and mysql userdb and
according to mysql logs it works as you described!
Will move from static to sql usersdb anyway.
Thanks!
Date: Sat, 24 Aug 2013 06:57:05
-0400
From: gedalya@gedalya.net
To: anton.chigin@live.com
CC: dovecot@dovecot.org
Subject: Re: [Dovecot] expire plugin doesn't work?
I don't know, why don't
you just try?
If you run the exact same command but with "search"
instead of "expunge", it should also use the expire
plugin in the same way, so that should be an easy
test.
Are you using sql for passdb? If so I wonder if you
could define an sql userdb in addition to the static
userdb with only an iterate_query defined..?
On 08/24/2013 06:46 AM, Anton Chigin wrote:
So,
is enabling expire plugin the only way "doveadm
expunge" to work with static userdb, because of
lack iterate_query option?
If I test it now "doveadm search" I see:
Aug 24 13:28:22 piscola dovecot: auth: Debug:
Loading modules from directory:
/usr/lib/dovecot/modules/auth
Aug 24 13:28:22 piscola dovecot: auth: Debug:
Module loaded:
/usr/lib/dovecot/modules/auth/libdriver_mysql.so
Aug 24 13:28:22 piscola dovecot: auth: Debug:
master in: LIST#0111
Aug 24 13:28:22 piscola dovecot: auth: Error:
Trying to iterate users, but userdbs don't
support it
userdb I have:
userdb {
args = uid=vmail gid=vmail
home=/home/mail/vhosts/%d/%n
driver = static
}
Is it OK and doveadm will not have to iterate
users since expire plugin is enabled?
Or should I still fix it to get it works
properly?
Thanks a lot for your help!
Date: Sat, 24 Aug 2013
06:22:32 -0400
From: gedalya@gedalya.net
To: anton.chigin@live.com
CC: dovecot@dovecot.org
Subject: Re: [Dovecot] expire plugin doesn't
work?
Yes, you add
that cron job, and it would work with or
without the expire plugin.
The thing is that if the expire plugin is
enabled, the "doveadm expunge" command will
look at the expires table in mysql and only
process users who are in the database with a
timestamp older than your specified message
age. The timestamp is supposed to designate
"age of oldest message in folder". Without the
expires plugin, the command would have to
process every user in the system (as per the
result of the iterate query, if you're using
SQL authentication) and actually open every
Trash folder and look inside, which would
normally be a lot more work and take more
time.
On 08/24/2013 06:16 AM, Anton Chigin wrote:
Hi!
Thanks for your suggestion, that moved
me in to right direction.
It was double permission issue, that I
was able to debug since changed format,
and now timestaps are added into the mysql
table.
As far as I understand expire plugin
only adds timestamps to mysql table, and
thats it, isn't it?
I mean I want to understand how to
configure mails to be removed...
Do I need to add to cron "doveadm
expunge -A mailbox Trash savedbefore
30d" ?
Thanks a lot!
> Date: Fri, 23 Aug 2013 21:17:34
-0400
> From: gedalya@gedalya.net
> To: dovecot@dovecot.org;
anton.chigin@live.com
> Subject: Re: [Dovecot] expire
plugin doesn't work?
>
> On 08/23/2013 09:05 PM, Anton
Chigin wrote:
> > plugin {
> > expire = Trash 7
> > expire_dict = proxy::expire
>
> You're using Dovecot 2.1, that
configuration syntax is for 1.2.
> Please follow documentation at http://wiki2.dovecot.org/Plugins/Expire
>
participants (2)
-
Anton Chigin
-
Gedalya