dovecot 2.3.16 fail one test on s390x, alpine linux

2021-08-10 Thread Milan P . Stanić
Hi,

I'm trying to upgrade dovecot from version 2.3.15 to 2.3.16 for alpine
linux. Build and 'make check' pass on all alpine architectures except on
s390x which is big-endian while all other are little-endian.

here is the part from CI build log which fails:

mail cache size corruption ... : ok
0 / 10 tests failed
test-mail-cache-fields.c:50: Assert failed: cache_field.last_used == 
priv->field.last_used && cache_field.decision == priv->field.decision
test-mail-cache-fields.c:65: Assert failed: cache_field.last_used == 
priv->field.last_used && cache_field.decision == priv->field.decision
test-mail-cache-fields.c:94: Assert failed: cache_field.last_used == 
priv->field.last_used && cache_field.decision == priv->field.decision
mail cache fields read-write . : FAILED
1 / 1 tests failed
make[3]: *** [Makefile:1279: check-local] Error 1
make[3]: Leaving directory 
'/builds/alpine/aports/main/dovecot/src/dovecot-2.3.16/src/lib-index'
make[2]: *** [Makefile:1049: check-am] Error 2
make[2]: Target 'check' not remade because of errors.
make[2]: Leaving directory 
'/builds/alpine/aports/main/dovecot/src/dovecot-2.3.16/src/lib-index'
Making check in lib-storage


Full log is here:
https://gitlab.alpinelinux.org/alpine/aports/-/jobs/459182/raw

-- 
Kind regards


Re: dovecot 2.3.16 fail one test on s390x, alpine linux

2021-08-10 Thread Timo Sirainen
On 10. Aug 2021, at 10.33, Michael Ströder  wrote:
> 
> On 8/10/21 10:02 AM, Milan P. Stanić wrote:
>> I'm trying to upgrade dovecot from version 2.3.15 to 2.3.16 for alpine
>> linux. Build and 'make check' pass on all alpine architectures except on
>> s390x which is big-endian while all other are little-endian.
> 
> You're probably hitting the same issues like me on openSUSE.
> 
> See Timo's response to that:
> 
> https://dovecot.org/pipermail/dovecot/2021-August/122787.html

The attached patch probably helps?



mail-cache-bigendian.diff
Description: Binary data




Re: dovecot 2.3.16 fail one test on s390x, alpine linux

2021-08-10 Thread Michael Ströder
On 8/10/21 10:02 AM, Milan P. Stanić wrote:
> I'm trying to upgrade dovecot from version 2.3.15 to 2.3.16 for alpine
> linux. Build and 'make check' pass on all alpine architectures except on
> s390x which is big-endian while all other are little-endian.

You're probably hitting the same issues like me on openSUSE.

See Timo's response to that:

https://dovecot.org/pipermail/dovecot/2021-August/122787.html

Ciao, Michael.


Re: dovecot 2.3.16 fail one test on s390x, alpine linux

2021-08-10 Thread Timo Sirainen
On 10. Aug 2021, at 14.17, Michael Ströder  wrote:
> 
> On 8/10/21 11:16 AM, Timo Sirainen wrote:
>> On 10. Aug 2021, at 10.33, Michael Ströder  wrote:
>>> 
>>> On 8/10/21 10:02 AM, Milan P. Stanić wrote:
 I'm trying to upgrade dovecot from version 2.3.15 to 2.3.16 for alpine
 linux. Build and 'make check' pass on all alpine architectures except on
 s390x which is big-endian while all other are little-endian.
>>> 
>>> You're probably hitting the same issues like me on openSUSE.
>>> 
>>> See Timo's response to that:
>>> 
>>> https://dovecot.org/pipermail/dovecot/2021-August/122787.html
>> 
>> The attached patch probably helps?
> 
> Assuming I've applied the patch correctly it does not help on ppc64 and
> S/390:
> 
> https://build.opensuse.org/package/show/home:stroeder:network/dovecot23 
> 

Well, that's annoying. I thought it would have worked. I wonder if it's still 
some issue with the #if not being right. Can you try once more with disabling 
the #if lines, i.e. just:

+static void
+copy_to_buf_last_used(struct mail_cache *cache, buffer_t *dest, bool add_new)
+{
+   size_t offset = offsetof(struct mail_cache_field, last_used);
+//#if defined(WORDS_BIGENDIAN) && TIME_T_BITS > 32
+   offset += sizeof(uint32_t);
+//#endif
+   copy_to_buf(cache, dest, add_new, offset, sizeof(uint32_t));
+}

If that doesn't work either, I'd somehow need to get access to a big-endian CPU 
to try to figure out where it's going wrong.



Re: dovecot 2.3.16 fail one test on s390x, alpine linux

2021-08-10 Thread Michael Ströder
On 8/10/21 11:16 AM, Timo Sirainen wrote:
> On 10. Aug 2021, at 10.33, Michael Ströder  wrote:
>>
>> On 8/10/21 10:02 AM, Milan P. Stanić wrote:
>>> I'm trying to upgrade dovecot from version 2.3.15 to 2.3.16 for alpine
>>> linux. Build and 'make check' pass on all alpine architectures except on
>>> s390x which is big-endian while all other are little-endian.
>>
>> You're probably hitting the same issues like me on openSUSE.
>>
>> See Timo's response to that:
>>
>> https://dovecot.org/pipermail/dovecot/2021-August/122787.html
> 
> The attached patch probably helps?

Assuming I've applied the patch correctly it does not help on ppc64 and
S/390:

https://build.opensuse.org/package/show/home:stroeder:network/dovecot23

You can download the complete build log, e.g. deep-link for S/390 build log:

https://build.opensuse.org/build/home:stroeder:network/openSUSE_Factory_zSystems/s390x/dovecot23/_log

Ciao, Michael.


GSSAPI mail home mapping problem

2021-08-10 Thread Lucas Castro

Hello,

I'm trying to map authenticated kerberos users to mail_location,


The problem when I set mail_home = /var/mail/virtual/domain1.zw.loca/%n 
works fine.


But if mail_home is set as /var/mail/virtual/%d/%n

I get

Apr 12 19:53:18 postfix10 dovecot: imap-login: Login: user=, 
method=GSSAPI, rip=172.16.0.44, lip=10.16.0.220, mpid=2428, 
session=
Apr 12 19:53:18 postfix10 dovecot: imap(us...@domain1.zw.local 
=login_user=user0)<2428>: Debug: Added userdb setting: 
plugin/=yes
Apr 12 19:53:18 postfix10 dovecot: imap(us...@domain1.zw.local 
=login_user=user0)<2428>: Debug: Effective uid=5000, 
gid=5000, home=/var/mail/virtual/domain1.zw.local =login_user=user0/user0


Right here, I can't figure out why login_user=user0/user0

Apr 12 19:53:18 postfix10 dovecot: imap(us...@domain1.zw.local 
=login_user=user0)<2428>: Debug: Namespace inbox: 
type=private, prefix=, sep=, inbox=yes, hidden=no, list=yes, 
subscriptions=yes location=maildir:~/mail


Now login_user=user0

Apr 12 19:53:18 postfix10 dovecot: imap(us...@domain1.zw.local 
=login_user=user0)<2428>: Debug: maildir++: 
root=/var/mail/virtual/domain1.zw.local =login_user=user0/user0/mail, 
index=, indexpvt=, control=, inbox=/var/mail/virtual/domain1.zw.local 
=login_user=user0/user0/mail, alt=


then login_user=user0/user0/mail

Apr 12 19:53:18 postfix10 dovecot: imap(us...@domain1.zw.local 
=login_user=user0)<2428>: Debug: Mailbox INBOX: 
Mailbox opened because: SELECT



doveconf  -n
# 2.3.4.1 (f79e8e7e4): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.5.4 ()
# OS: Linux 5.10.0-7-amd64 x86_64 Debian 10.6
# Hostname: postfix10.zw.local
auth_debug = yes
auth_gssapi_hostname = $ALL
auth_krb5_keytab = /etc/dovecot/imap.keytab
auth_mechanisms = gssapi
auth_verbose = yes
disable_plaintext_auth = no
import_environment = TZ KRB5CCNAME=/etc/dovecot/imap.ticket 
KRB5_KTNAME=/etc/dovecot/imap.keytab

mail_debug = yes
mail_gid = 5000
mail_home = /var/mail/virtual/%d/%n
mail_location = maildir:~/mail
mail_privileged_group = mail
mail_uid = 5000
namespace inbox {
  disabled = no
  inbox = yes
  list = 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 =
  type = private
}
passdb {
  args = /etc/dovecot/dovecot-ldap.conf.ext
  driver = ldap
}
protocols = " imap lmtp pop3"
service lmtp {
  unix_listener /var/spool/postfix/private/dovecot-lmtp {
    group = postfix
    mode = 0600
    user = postfix
  }
}
ssl = no
ssl_cert = ldap://ldap10.zw.local
auth_bind = yes
sasl_bind = yes
sasl_mech = gssapi
sasl_realm = zw.local
debug_level = -1
ldap_version = 3
base = dc=zw,dc=local
user_attrs = \
    =user=%{ldap:mail} \
    =login_user=%{ldap:uid}
user_filter = (uid=%n)
pass_attrs = \
    =user=%{ldap:uid},\
    =k5principals=%{ldap:krbPrincipalName}
pass_filter = (&(objectClass=krbPrincipalAux)(uid=%n))


--
Lucas Castro



Re: GSSAPI mail home mapping problem

2021-08-10 Thread Lucas Castro

Sorry, my fault, I missed some comma on user and pass attrs.


On 8/10/21 1:31 PM, Lucas Castro wrote:

Hello,

I'm trying to map authenticated kerberos users to mail_location,


The problem when I set mail_home = 
/var/mail/virtual/domain1.zw.loca/%n works fine.


But if mail_home is set as /var/mail/virtual/%d/%n

I get

Apr 12 19:53:18 postfix10 dovecot: imap-login: Login: user=, 
method=GSSAPI, rip=172.16.0.44, lip=10.16.0.220, mpid=2428, 
session=
Apr 12 19:53:18 postfix10 dovecot: imap(us...@domain1.zw.local 
=login_user=user0)<2428>: Debug: Added userdb 
setting: plugin/=yes
Apr 12 19:53:18 postfix10 dovecot: imap(us...@domain1.zw.local 
=login_user=user0)<2428>: Debug: Effective uid=5000, 
gid=5000, home=/var/mail/virtual/domain1.zw.local =login_user=user0/user0


Right here, I can't figure out why login_user=user0/user0

Apr 12 19:53:18 postfix10 dovecot: imap(us...@domain1.zw.local 
=login_user=user0)<2428>: Debug: Namespace inbox: 
type=private, prefix=, sep=, inbox=yes, hidden=no, list=yes, 
subscriptions=yes location=maildir:~/mail


Now login_user=user0

Apr 12 19:53:18 postfix10 dovecot: imap(us...@domain1.zw.local 
=login_user=user0)<2428>: Debug: maildir++: 
root=/var/mail/virtual/domain1.zw.local =login_user=user0/user0/mail, 
index=, indexpvt=, control=, inbox=/var/mail/virtual/domain1.zw.local 
=login_user=user0/user0/mail, alt=


then login_user=user0/user0/mail

Apr 12 19:53:18 postfix10 dovecot: imap(us...@domain1.zw.local 
=login_user=user0)<2428>: Debug: Mailbox INBOX: 
Mailbox opened because: SELECT



doveconf  -n
# 2.3.4.1 (f79e8e7e4): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.5.4 ()
# OS: Linux 5.10.0-7-amd64 x86_64 Debian 10.6
# Hostname: postfix10.zw.local
auth_debug = yes
auth_gssapi_hostname = $ALL
auth_krb5_keytab = /etc/dovecot/imap.keytab
auth_mechanisms = gssapi
auth_verbose = yes
disable_plaintext_auth = no
import_environment = TZ KRB5CCNAME=/etc/dovecot/imap.ticket 
KRB5_KTNAME=/etc/dovecot/imap.keytab

mail_debug = yes
mail_gid = 5000
mail_home = /var/mail/virtual/%d/%n
mail_location = maildir:~/mail
mail_privileged_group = mail
mail_uid = 5000
namespace inbox {
  disabled = no
  inbox = yes
  list = 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 =
  type = private
}
passdb {
  args = /etc/dovecot/dovecot-ldap.conf.ext
  driver = ldap
}
protocols = " imap lmtp pop3"
service lmtp {
  unix_listener /var/spool/postfix/private/dovecot-lmtp {
    group = postfix
    mode = 0600
    user = postfix
  }
}
ssl = no
ssl_cert = ldap://ldap10.zw.local
auth_bind = yes
sasl_bind = yes
sasl_mech = gssapi
sasl_realm = zw.local
debug_level = -1
ldap_version = 3
base = dc=zw,dc=local
user_attrs = \
    =user=%{ldap:mail} \
    =login_user=%{ldap:uid}
user_filter = (uid=%n)
pass_attrs = \
    =user=%{ldap:uid},\
    =k5principals=%{ldap:krbPrincipalName}
pass_filter = (&(objectClass=krbPrincipalAux)(uid=%n))



--
Lucas Castro



Re: dovecot 2.3.16 fail one test on s390x, alpine linux

2021-08-10 Thread Timo Sirainen
On 10. Aug 2021, at 19.54, Michael Ströder  wrote:
> 
> Timo,
> 
> On 8/10/21 5:55 PM, Timo Sirainen wrote:
>> Well, that's annoying. I thought it would have worked. I wonder if it's
>> still some issue with the #if not being right. Can you try once more
>> with disabling the #if lines, i.e. just:
> 
> It's currently still building on other big-endian platforms. But at
> least S/390 succeeded. (All low-endian platforms now fail but that's
> expected.)

The attached patch should work. TIME_T_BITS was originally typoed, should have 
been TIME_T_MAX_BITS. But even that isn't really a good way to check it. 
SIZEOF_VOID_P == 8 should work well enough.



mail-cache-bigendian.diff
Description: Binary data




Test for implicit keep within a sieve script

2021-08-10 Thread Eric Durand
Hi folks,

Is there a good way to test for an implicit keep in a sieve script  ? At
the end of my sieve script, if a message still has an implicit keep, it
will end up in my inbox, and I would like to push a notification. Right now
I am doing this with an ad-hoc variable that is essentially emulating the
implicit keep, is there a better way to do this ?

Thanks!
Eric


Re: dovecot 2.3.16 fail one test on s390x, alpine linux

2021-08-10 Thread Michael Ströder
Timo,

On 8/10/21 5:55 PM, Timo Sirainen wrote:
> Well, that's annoying. I thought it would have worked. I wonder if it's
> still some issue with the #if not being right. Can you try once more
> with disabling the #if lines, i.e. just:

It's currently still building on other big-endian platforms. But at
least S/390 succeeded. (All low-endian platforms now fail but that's
expected.)

> If that doesn't work either, I'd somehow need to get access to a
> big-endian CPU to try to figure out where it's going wrong.

openSUSE build system is open for the public:

Get yourself an account by clicking "Sign  Up" here:
https://build.opensuse.org

You then have a home project home:username in which you can build any
packages you want for a wide range of platforms. The build workers are
often native hardware.

You could branch the existing official devel dovecot23 package and do
whatever tests you want to do:

https://build.opensuse.org/package/show/server:mail/dovecot23

My own package builds are also just a branch of the above where I
prepare the 2.3.16 update:

https://build.opensuse.org/package/show/home:stroeder:network/dovecot23

Let me know if you need further information, though I'm not an OBS expert.

Ciao, Michael.


pigeonhole-0.5.16 compilation error?

2021-08-10 Thread Sylvain Robitaille


Hello Dovecot folks ...

In response to the recent announcement of Dovecot-2.3.16
and pigeonhole-0.5.16, we decided to update our installation
(full disclosure: this is really an update from dovecot-1.2.x in
progress; we're working on a development system where we already had
dovecot-2.3.x installed and running).  The update of dovecot itself
(compiled from source), to version 2.3.16 was quite uneventful, and
I can report that it's working.  We're seeing some behaviour with
indexing that will need attention, but I suspect that that's a matter
of configuration, and is completely unrelated to what I'm reporting.

More disclosure: we've never used nor compiled pigeonhole on
our systems before.  We've been using procmail for decades,
but are now looking into potentially switching to sieve, and as
I understand it, that means installing pigeonhole.  I downloaded
dovecot-2.3-pigeonhole-0.5.16 at the same time that I downloaded
dovecot-2.3.16, a few days ago.

My build-time configure and make for pigeonhole is relatively simple,
but fails to build:

   ./configure --prefix=/local/pkg/pigeonhole-0.5.16/root \
   --sbindir=/local/pkg/pigeonhole-0.5.16/root/bin \
   --localstatedir=/var \
   --mandir=/local/pkg/pigeonhole-0.5.16/root/man \
   --with-dovecot=/local/pkg/dovecot-CURRENT/root/lib/dovecot
make -j2

"/local/pkg/dovecot-CURRENT/root/lib/dovecot" is correct for us, if I
understand the installation instructions correctly:

   -rw-r--r-- 1 root root 1324 Aug  3 14:03 
/local/pkg/dovecot-CURRENT/root/lib/dovecot/dovecot-config

The make fails, while compiling sieve-extprograms-common.c:

   sieve-extprograms-common.c: In function ‘sieve_extprogram_run’:
   sieve-extprograms-common.c:639:7: error: 
‘PROGRAM_CLIENT_EXIT_STATUS_INTERNAL_FAILURE’ undeclared (first use in this 
function)
 case PROGRAM_CLIENT_EXIT_STATUS_INTERNAL_FAILURE:
  ^
   sieve-extprograms-common.c:639:7: note: each undeclared identifier is 
reported only once for each function it appears in
   sieve-extprograms-common.c:641:7: error: 
‘PROGRAM_CLIENT_EXIT_STATUS_FAILURE’ undeclared (first use in this function)
 case PROGRAM_CLIENT_EXIT_STATUS_FAILURE:
  ^
   sieve-extprograms-common.c:643:7: error: 
‘PROGRAM_CLIENT_EXIT_STATUS_SUCCESS’ undeclared (first use in this function)
 case PROGRAM_CLIENT_EXIT_STATUS_SUCCESS:
  ^

I decided to check against dovecot-2.3-pigeonhole-0.5.15, figuring
that problems compiling that version likely would have been reported
already, and sure enough I find the following difference in this file:

   --- 
./dovecot-2.3-pigeonhole-0.5.15/src/plugins/sieve-extprograms/sieve-extprograms-common.c
2021-06-14 09:41:29.0 -0400
   +++ 
./dovecot-2.3-pigeonhole-0.5.16/src/plugins/sieve-extprograms/sieve-extprograms-common.c
2021-08-06 05:26:46.0 -0400
   @@ -635,6 +635,14 @@ int sieve_extprogram_set_input_mail

int sieve_extprogram_run(struct sieve_extprogram *sprog)
{
   -   return program_client_run(sprog->program_client);
   +   switch (program_client_run(sprog->program_client)) {
   +   case PROGRAM_CLIENT_EXIT_STATUS_INTERNAL_FAILURE:
   +   return -1;
   +   case PROGRAM_CLIENT_EXIT_STATUS_FAILURE:
   +   return 0;
   +   case PROGRAM_CLIENT_EXIT_STATUS_SUCCESS:
   +   return 1;
   +   }
   +   i_unreached();
}

... and no mention of these PROGRAM_CLIENT_EXIT_STATUS_* constants
anywhere else in the code, in either version.  Have I stumbled onto
an omission in the packaged sources, or is there some other package
missing on my system, or is there perhaps even some other explanation
for what I'm seeing?

I've checked the mailing list archive and found no mention of anyone
else having the same (or similar) problem, so I do think it's possible
that I'm just missing something ...

Thanks in advance for any insight folks might be able to give me ...

--
--
Sylvain Robitaille   s...@encs.concordia.ca

Systems analyst / AITSConcordia University
Faculty of Engineering and Computer Science   Montreal, Quebec, Canada
--

Re: pigeonhole-0.5.16 compilation error?

2021-08-10 Thread Sylvain Robitaille


(following up to my own message ...)


On Tue, 10 Aug 2021, I wrote:


My build-time configure and make for pigeonhole is relatively simple,
but fails to build:

  ./configure --prefix=/local/pkg/pigeonhole-0.5.16/root \
  --sbindir=/local/pkg/pigeonhole-0.5.16/root/bin \
  --localstatedir=/var \
  --mandir=/local/pkg/pigeonhole-0.5.16/root/man \
  --with-dovecot=/local/pkg/dovecot-CURRENT/root/lib/dovecot
   make -j2

"/local/pkg/dovecot-CURRENT/root/lib/dovecot" is correct for us, if I
understand the installation instructions correctly:

  -rw-r--r-- 1 root root 1324 Aug  3 14:03 
/local/pkg/dovecot-CURRENT/root/lib/dovecot/dovecot-config


The make fails, while compiling sieve-extprograms-common.c:

  sieve-extprograms-common.c: In function ‘sieve_extprogram_run’:
  sieve-extprograms-common.c:639:7: error: 
‘PROGRAM_CLIENT_EXIT_STATUS_INTERNAL_FAILURE’ undeclared (first use in this 
function)

case PROGRAM_CLIENT_EXIT_STATUS_INTERNAL_FAILURE:
 ^
  sieve-extprograms-common.c:639:7: note: each undeclared identifier is 
reported only once for each function it appears in
  sieve-extprograms-common.c:641:7: error: 
‘PROGRAM_CLIENT_EXIT_STATUS_FAILURE’ undeclared (first use in this function)

case PROGRAM_CLIENT_EXIT_STATUS_FAILURE:
 ^
  sieve-extprograms-common.c:643:7: error: 
‘PROGRAM_CLIENT_EXIT_STATUS_SUCCESS’ undeclared (first use in this function)

case PROGRAM_CLIENT_EXIT_STATUS_SUCCESS:
 ^


Just after I sent that, a colleague found the string in
/local/pkg/dovecot-2.3.16/root/include/dovecot/program-client.h;  Ok,
great, but that's why we want to point to dovecot-config, so this can be
found ...  except:

   : lust[syl] ~; grep -w include 
/local/pkg/dovecot-CURRENT/root/lib/dovecot/dovecot-config
   LIBDOVECOT_INCLUDE=-I/local/pkg/dovecot-2.3.15/root/include/dovecot
   dovecot_pkgincludedir=/local/pkg/dovecot-2.3.15/root/include/dovecot

Well that explains the compilation error on pigeonhole.  No I need only
to figure out why dovecot-config is pointing to the old version ...

(for the record, I suspect my "dovecot-CURRENT" symlink wasn't correctly
updated ... sorry for the noise ...)

--
--
Sylvain Robitaille   s...@encs.concordia.ca

Systems analyst / AITSConcordia University
Faculty of Engineering and Computer Science   Montreal, Quebec, Canada
--

Re: dovecot 2.3.16 fail one test on s390x, alpine linux

2021-08-10 Thread Michael Ströder
On 8/10/21 8:59 PM, Timo Sirainen wrote:
> On 10. Aug 2021, at 19.54, Michael Ströder  wrote:
>>
>> Timo,
>>
>> On 8/10/21 5:55 PM, Timo Sirainen wrote:
>>> Well, that's annoying. I thought it would have worked. I wonder if it's
>>> still some issue with the #if not being right. Can you try once more
>>> with disabling the #if lines, i.e. just:
>>
>> It's currently still building on other big-endian platforms. But at
>> least S/390 succeeded. (All low-endian platforms now fail but that's
>> expected.)
> 
> The attached patch should work.

This works. Thank you.

So I can push the update towards openSUSE Factory now.

Ciao, Michael.


Re: Test for implicit keep within a sieve script

2021-08-10 Thread Aki Tuomi


> On 10/08/2021 23:32 Eric Durand  wrote:
> 
> 
> Hi folks,
> 
> Is there a good way to test for an implicit keep in a sieve script ? At the 
> end of my sieve script, if a message still has an implicit keep, it will end 
> up in my inbox, and I would like to push a notification. Right now I am doing 
> this with an ad-hoc variable that is essentially emulating the implicit keep, 
> is there a better way to do this ?
> 
> Thanks!
> Eric

You could use push notification plugin for this. 
https://doc.dovecot.org/configuration_manual/push_notification/#lua-lua

Aki