This change also slightly changes the lmtp log prefixes in some places.
It removes "conn $ip:$port [$idx]: rcpt $user:" from some of the log
messages (but that wasn't in all of the log messages anyway), but it now
always includes mail_log_prefix in these log messages, which previously
wasn't always set at that point yet.
Timo Sirainen [Fri, 4 Nov 2022 19:58:30 +0000 (21:58 +0200)]
login-common: Handle haproxy's TLS terminated connections same as if Dovecot did TLS termination
If haproxy is running on localhost, this is clearly the case. If haproxy
is not running on localhost, it's a bit more ambiguous. It is possible to
configure haproxy to do TLS termination and then use another TLS connection
towards Dovecot, but this is likely a not so common configuration. More
likely the intention is that if haproxy has done TLS termination, it should
be handle the same as if Dovecot had done it.
This commit doesn't actually change any behavior. It just makes the tls
variables work in a more consistent way.
Timo Sirainen [Fri, 4 Nov 2022 21:50:49 +0000 (23:50 +0200)]
login-common: Connections from haproxy are always considered secured
Similarly to non-haproxy connections from login_trusted_networks are
considered secured, connections from haproxy_trusted_networks should also be
considered secured.
Timo Sirainen [Thu, 3 Nov 2022 17:22:07 +0000 (19:22 +0200)]
lib-master: Rename "proxy" connections to "haproxy"
We already have a Dovecot proxy, and naming haproxy connections simply as
"proxy" just causes confusion. If we end up supporting other types of
proxy protocols later on, we can try to figure out a better name.
Aki Tuomi [Tue, 15 Nov 2022 11:44:46 +0000 (13:44 +0200)]
lib: event-filter - Ensure 0 can be matched correctly in filters
Allow matching fields with > 0, priorly this would have always been
treated as string equality / wildcard match, instead we now want
to match it as number. Forgotten in 61cb32860f5237c5d928a7fed8a89f783c2f9b30
Aki Tuomi [Tue, 15 Nov 2022 11:22:16 +0000 (13:22 +0200)]
lib: event-filter - Fix matching duration field
If duration field is used in event filter, it cannot be matched
here as no such field exists. We need to actually synthesize the
field here for matching.
In 1a7b1f66fe the non-standard extern timezone was partially removed,
but some instances were left. Since the test is supposed to run with
TZ=UTC, and timezone would have been zero anyway, remove them all.
Timo Sirainen [Mon, 31 Oct 2022 20:37:34 +0000 (22:37 +0200)]
dsync: Revert logging a more detailed reason why mailbox was lost
This code can't actually work, because the mailbox allocation is attempted
in multiple namespaces. The error would just come from the last namespace,
which might not have been the correct one.
Timo Sirainen [Thu, 27 Oct 2022 21:56:29 +0000 (00:56 +0300)]
maildir: If mailbox create fails, don't try to apply mailbox_update changes
This was especially causing problems with mailbox GUID mismatches in dsync.
The mismatch wasn't automatically fixed, because mailbox_create() incorrectly
kept updating the mailbox GUID for the already existing mailbox.
Fixes errors such as:
Remote lost mailbox GUID ... (maybe it was just deleted?)
Timo Sirainen [Mon, 31 Oct 2022 09:23:00 +0000 (11:23 +0200)]
replication plugin: Use "replication: " log prefix for all log messages
Some of the messages were missing the prefix. Some were using
"replication(user): " as the prefix, which was unnecessary since the
mail_log_prefix already contains the username.
Timo Sirainen [Tue, 25 Oct 2022 10:27:23 +0000 (13:27 +0300)]
replicator: Make sure to prevent request starvation
This synchronizes how priority queue is ordered vs what
replicator_queue_want_sync_now() returns. The mismatch might have caused
request starvation in some situations because they behaved differently.
Also this change makes sure that higher priority requests don't infinitely
block lower priority requests. Instead, they get a temporary boost time
(hardcoded 15-45 minutes). Afterwards lower priority requests are started
to be handled as well.
Timo Sirainen [Tue, 25 Oct 2022 10:11:37 +0000 (13:11 +0300)]
replicator: Don't update user's last_update if priority doesn't change
This didn't actually matter, since it was only used to check if importing
should update an existing user. However, importing is only run at startup
when all users have last_update=0 anyway.
The following changes bring new use cases for last_update.
Timo Sirainen [Tue, 25 Oct 2022 09:49:03 +0000 (12:49 +0300)]
replicator: Fix user placement in replication queue
Especially replicator queue importing and NOTIFY command could have
placed the user to wrong place in the queue, because they modified the
last sync timestamps afterwards.
Fixed by splitting replicator_queue_add() into get/update/add(), so all
the necessary changes can be done before replicator_queue_add() is used
to place the user into the queue.