Gather statistics to check effectivity of spam filter?

2024-05-30 Thread Camilo Sperberg via dovecot
Hi list :)

We want to make some changes to our spam filter, but we first want to
be able to check if what we do does have any effect.

So I was thinking of storing in our statistics if somebody moves an
email to their Junk folder (or even better: vice versa).

I have created the following metric for this:

metric imap_command_move {
  filter = event=imap_command_finished AND cmd_name="UID MOVE" AND
(cmd_args = "* Junk" OR cmd_args = "* INBOX")
  group_by = cmd_args
}


And when I move something to the Junk folder I get the following after
a doveadm stats dump:

(...)
imap_command_moveduration525252927061124989
50505.803447637503.81124989
imap_command_move_15_Junkduration1124989124989
124989124989.001249890.00124989
imap_command_move_14_Junkduration1387253872538725
  38725.00387250.0038725
imap_command_move_12_INBOXduration1270612706127061
   27061.00270610.0027061
imap_command_move_13_INBOXduration1272782727827278
   27278.00272780.0027278
imap_command_move_3_INBOXduration1344763447634476
  34476.00344760.0034476


In my example, I moved 6 messages: 2 from INBOX to Junk, 1 from INBOX
to a separate folder, 2 from Junk back to INBOX and 1 from the
separate folder back to INBOX.

However, because I'm grouping by cmd_args, it includes the full parameters:
IMAP command’s full parameters (e.g. 1:* FLAGS)

https://doc.dovecot.org/admin_manual/list_of_events/#imap-command

Is there a way to filter out the first part so that I ideally get a
stat named imap_command_move_Junk & imap_command_move_INBOX?

Is there perhaps a way to get to know specifically the from and to
folders the user is moving the mail from and to?

Thanks!
___
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org


Re: Local auth works with dovecot-proxy, remote does not

2021-08-30 Thread Camilo Sperberg
I think I have found the issue: I'm missing the auth_proxy_self setting:

https://doc.dovecot.org/configuration_manual/authentication/proxies/

When I set this to the IP of the server, it seems to perform the
authentication without issues for webmail as external clients such as
Thunderbird.

Greetings,
Camilo Sperberg

On Tue, Aug 24, 2021 at 2:37 PM Camilo Sperberg  wrote:

> Hi list!
>
> I've configured dovecot-proxy to redirect users to another server if their
> data is indeed on that other server.
>
> Webmail (which runs on the same machine) works perfectly fine, but clients
> such as Thunderbird and Outlook do not work as intended, I suspect it to be
> a problem with the IP that dovecot-proxy sees, but I can't figure out what
> is wrong: I've already done a lot of Googling and also tried to change the
> login_trusted_networks value, but to no avail.
>
> I've enabled debug log and here is the relevant part of a call that fails
> and another one that succeeds (FYI 10.164.0.3 is the machine that is doing
> the proxying and where webmail is located, 10.164.0.20 is the 'node', these
> logs come from that node, doveconf -n is also provided in the gist):
> https://gist.github.com/unreal4u/64de0f05b6e3b98034cdb0ae52ce1196
>
> So as far as I can interpret the logs, in the failure case it is basically
> saying it should go to the node, despite it already being on that node:
> Aug 24 11:29:07 mail-node-2 dovecot: auth: Debug: client passdb out:
> OK#0112#011user=m...@xx.xx
> #011host=10.164.0.20#011port=143#011proxy#011pass=
>
> In the success case, I don't see any mention of a proxy:
> Aug 24 11:35:21 mail-node-2 dovecot: auth: Debug: client passdb out:
> OK#0116#011user=m...@x.xx
>
>
> What am I missing here? Has this something to do with
> authentication-allow-nets or authentication-allow-real-nets ? If so: where
> to define it? Is there something else I'm missing?
>
> Thanks in advance for your help,
> Camilo Sperberg
>


Local auth works with dovecot-proxy, remote does not

2021-08-24 Thread Camilo Sperberg
Hi list!

I've configured dovecot-proxy to redirect users to another server if their
data is indeed on that other server.

Webmail (which runs on the same machine) works perfectly fine, but clients
such as Thunderbird and Outlook do not work as intended, I suspect it to be
a problem with the IP that dovecot-proxy sees, but I can't figure out what
is wrong: I've already done a lot of Googling and also tried to change the
login_trusted_networks value, but to no avail.

I've enabled debug log and here is the relevant part of a call that fails
and another one that succeeds (FYI 10.164.0.3 is the machine that is doing
the proxying and where webmail is located, 10.164.0.20 is the 'node', these
logs come from that node, doveconf -n is also provided in the gist):
https://gist.github.com/unreal4u/64de0f05b6e3b98034cdb0ae52ce1196

So as far as I can interpret the logs, in the failure case it is basically
saying it should go to the node, despite it already being on that node:
Aug 24 11:29:07 mail-node-2 dovecot: auth: Debug: client passdb out:
OK#0112#011user=m...@xx.xx
#011host=10.164.0.20#011port=143#011proxy#011pass=

In the success case, I don't see any mention of a proxy:
Aug 24 11:35:21 mail-node-2 dovecot: auth: Debug: client passdb out:
OK#0116#011user=m...@x.xx


What am I missing here? Has this something to do with
authentication-allow-nets or authentication-allow-real-nets ? If so: where
to define it? Is there something else I'm missing?

Thanks in advance for your help,
Camilo Sperberg


Re: dovecot-lmtp crashing when setting lmtp_proxy=yes

2021-07-19 Thread Camilo Sperberg
Your solution did work perfectly, although I had to enable an inet-listener
because I had only a socket connection configured. In hindsight the problem
was pretty obvious but the segfault threw me off a bit.

Thanks for the answer!

Greetings,
Camilo Sperberg

On Fri, Jul 16, 2021 at 8:10 AM Aki Tuomi 
wrote:

>
> > On 15/07/2021 18:37 Camilo Sperberg  wrote:
> >
> >
> > Hi all:
> >
> > We are currently in the process of setting up dovecot proxy so that we
> can deploy multiple machines in order to keep growing.
> >
> > We are trying now to create an entry point, and from there send the
> traffic to either the same machine or another node.
> > For this, we are using a MySQL database with information about which
> server hosts which mailboxes, which turns out to be working great for
> sending out mail and general authentification. This was really simple to
> set up, kudos for that!
> >
> >
> > However, whenever I want to *receive* email, I just have to enable the
> lmtp_proxy setting which makes the lmtp process segfault.
> >
> > This happens everytime as I can reliable reproduce it + get a stack
> trace of it. The process will crash on every incoming email.
> >
> >
> > I have attached:
> > - Complete output of dovecot-sysreport
> > - A core dump of the crashed process
> >
> > Main information:
> > Using dovecot v2.3.14 (cee3cbc0d) on Ubuntu 18.04 LTS: Linux
> 5.4.0-1046-gcp x86_64 Ubuntu 18.04.5 LTS. Our MTA is postfix.
> >
> > Logs around the crashed process:
> > Jul 15 14:53:21 server postfix/postscreen[19402]: CONNECT from >
> >
> > Am I missing something in the conf? Did I encounter a bug? If you need
> more information, please let me know.
> >
> > Greetings,
> > Camilo Sperberg
> >
>
> Hi!
>
> Try returning port for the LMTP connection in your passdb query.
>
> Aki
>