Re: lmtp multiple mailboxes

2020-09-19 Thread Piotr Auksztulewicz
On Fri, Sep 18, 2020 at 11:41:40PM +0300, Janis wrote:
> What would be the best way to implement "deliver mail to multiple maildirs"
> through LMTP in Dovecot? Like in Postfix virtual_maps.

If you want to deliver to multiple dovecot accounts, it's easier on MTA
side, making a multiple-destination alias, so your MTA will perform
multiple LMTP transactions.

On the other hand, if you want to deliver multiple copies to a single
dovecot account, but into several different folders, it can be done easily
using a sieve script like this:

fileinto :copy "somefolder"
fileinto :copy "anotherfolder"
# etc.

it will leave the message in INBOX (implicit keep) if you use :copy
or you can prevent it by omitting :copy in the last one. You can also
put sone conditional around, so only specific emails get copied or
set some flags while doing it, etc. I use it all the time, e.g. mails
from this list get copied to my archive marked as read while being
left in inbox for me to browse and just delete, so I don't have to
move them to archive manually.

-- 
Piotr "Malgond" Auksztulewicz firstn...@lastname.net


auth_passdb_request_finished request fires twice on IMAP login

2020-09-19 Thread Eirik Rye

Hi,

Dovecot v2.3.11.3 (502c39af9)

auth_passdb_request_finished appears to fire twice for an IMAP login 
using a Redis passdb. auth_request_finished only fires once.


In the debug log below, the line "Finished passdb lookup" appears to be 
logged twice (once by "auth" and once by "auth-worker"). However, the 
actual passdb lookup against Redis is only performed once. This is 
confirmed by monitoring queries made against Redis.


Configuration:
--

metric auth_passdb_request_finished {
  event_name = auth_passdb_request_finished
}

auth_debug = yes
passdb {
  auth_verbose = yes
  override_fields = proxy=y
  name = redis
  driver = dict
  args = /etc/dovecot/dovecot-redis.conf.ext
}

--

With the above configuration, I am seeing the 
auth_passdb_request_finished metric being incremented twice for every 
successful login:


--
/ # doveadm stats dump
metric_name field   count   sum min max avg median 
stddev  %95
auth_passdb_request_finishedduration0   0   0 
0   0.000   0.00   0

/ # curl imap://localhost -u foo:bar -XNOOP
/ # doveadm stats dump
metric_name field   count   sum min max avg median 
stddev  %95
auth_passdb_request_finishedduration2   20327   6240 
14087   10163.5010163  3923.50 14087

--

This is the (anonymized) debug output emitted for the above commands:

--
Sep 19 15:03:32 auth: Debug: client in: AUTH1   PLAIN 
service=imapsecured session=msC166uvOL0K9HPGlip=127.0.0.1 
   rip=127.0.0.1  lport=143   rport=48440   resp=
Sep 19 15:03:32 auth: Debug: redis(foo,127.0.0.1,): 
Performing passdb lookup
Sep 19 15:03:32 auth-worker(76): Debug: conn unix:auth-worker 
(pid=30,uid=90): auth-worker<3>: Handling PASSV request
Sep 19 15:03:32 auth-worker(76): Debug: 
redis(foo,127.0.0.1,): Performing passdb lookup
Sep 19 15:03:32 auth-worker(76): Debug: 
redis(foo,127.0.0.1,): Lookup: shared/users/foo = 
{"user":"foo","password":"{SHA256-CRYPT}[...]","host":"other_host","uid":1000,"home":"\/mail\/foo"}
Sep 19 15:03:32 auth-worker(76): Debug: 
redis(foo,127.0.0.1,): Finished passdb lookup
Sep 19 15:03:32 auth-worker(76): Debug: conn unix:auth-worker 
(pid=30,uid=90): auth-worker<3>: Finished
Sep 19 15:03:32 auth: Debug: redis(foo,127.0.0.1,): 
Finished passdb lookup
Sep 19 15:03:32 auth: Debug: auth(foo,127.0.0.1,): 
Auth request finished
Sep 19 15:03:32 auth: Debug: client passdb out: OK  1   user=foo 
 proxy   host=other_host uid=1000  home=/mail/foo 
hostip=127.0.0.2pass=

--

Best regards,
Eirik
--
Eirik


auth_passdb_request_finished request fires twice on IMAP login

2020-09-19 Thread Eirik Rye

Hi,

Dovecot v2.3.11.3 (502c39af9)

auth_passdb_request_finished appears to fire twice for an IMAP login 
using a Redis passdb. auth_request_finished only fires once.


In the debug log below, the line "Finished passdb lookup" appears to be 
logged twice (once by "auth" and once by "auth-worker"). However, the 
actual passdb lookup against Redis is only performed once. This is 
confirmed by monitoring queries made against Redis.


Configuration:
--

metric auth_passdb_request_finished {
  event_name = auth_passdb_request_finished
}

auth_debug = yes
passdb {
  auth_verbose = yes
  override_fields = proxy=y
  name = redis
  driver = dict
  args = /etc/dovecot/dovecot-redis.conf.ext
}

--

With the above configuration, I am seeing the 
auth_passdb_request_finished metric being incremented twice for every 
successful login:


--
/ # doveadm stats dump
metric_name field   count   sum min max avg median 
stddev  %95
auth_passdb_request_finishedduration0   0   0 
0   0.000   0.00   0

/ # curl imap://localhost -u foo:bar -XNOOP
/ # doveadm stats dump
metric_name field   count   sum min max avg median 
stddev  %95
auth_passdb_request_finishedduration2   20327   6240 
14087   10163.5010163  3923.50 14087

--

This is the (anonymized) debug output emitted for the above commands:

--
Sep 19 15:03:32 auth: Debug: client in: AUTH1   PLAIN 
service=imapsecured session=msC166uvOL0K9HPGlip=127.0.0.1 
   rip=127.0.0.1  lport=143   rport=48440   resp=
Sep 19 15:03:32 auth: Debug: redis(foo,127.0.0.1,): 
Performing passdb lookup
Sep 19 15:03:32 auth-worker(76): Debug: conn unix:auth-worker 
(pid=30,uid=90): auth-worker<3>: Handling PASSV request
Sep 19 15:03:32 auth-worker(76): Debug: 
redis(foo,127.0.0.1,): Performing passdb lookup
Sep 19 15:03:32 auth-worker(76): Debug: 
redis(foo,127.0.0.1,): Lookup: shared/users/foo = 
{"user":"foo","password":"{SHA256-CRYPT}[...]","host":"other_host","uid":1000,"home":"\/mail\/foo"}
Sep 19 15:03:32 auth-worker(76): Debug: 
redis(foo,127.0.0.1,): Finished passdb lookup
Sep 19 15:03:32 auth-worker(76): Debug: conn unix:auth-worker 
(pid=30,uid=90): auth-worker<3>: Finished
Sep 19 15:03:32 auth: Debug: redis(foo,127.0.0.1,): 
Finished passdb lookup
Sep 19 15:03:32 auth: Debug: auth(foo,127.0.0.1,): 
Auth request finished
Sep 19 15:03:32 auth: Debug: client passdb out: OK  1   user=foo 
 proxy   host=other_host uid=1000  home=/mail/foo 
hostip=127.0.0.2pass=

--

Best regards,
Eirik


extra fields question

2020-09-19 Thread joao

Hi,

I'm trying to configure the use of plugins per user in dovecot, more 
specifically, fts and fts_solr. It happen to have other necessary 
plugins per protocol, for example "imap_quota" which would be 
specifically for the imap protocol and which does not apply for the lmtp 
protocol.


For this I need to specify that for the imap protocol I have:

protocol imap {
  mail_plugins = quota imap_quota zlib imap_sieve mail_log notify
}

and for the lmtp protocol I have:

protocol lmtp {
  mail_plugins = quota zlib fts fts_solr sieve
}


I did it according to the "extra fields" documentation and separated the 
name and key with /. My queries are correct but are not being applied to 
dovecot. Then in the case when the user has fts fts_solr he returns:


procotol/imap/mail_plugins -> quota imap_quota zlib imap_sieve mail_log 
notify fts fts_solr

procotol/lmtp/mail_plugins -> quota zlib sieve fts fts_solr

but it does not work. Doing it for "mail_plugins" (without accessing 
config levels) extra fields works, but it also enable some plugins that 
are not compatible with some protocols.


I thought about separating an instance of dovecot lmtp on the same 
server, but I would like a more direct configuration in the same 
instance. Does anyone have experience with this?

Thanks in advance.