Adds max worker capacity of 500 to the worker pool,
and an automatic shutdown of idle workers.
Messages that would cause the capacity to be exceeded,
are deferred.
Additionally, ensures that the same worker
is not spawned by two tasks at the same time.
Signed-off-by: Jagoda Ślązak <jslazak@jslazak.com>
Implements a per-destination worker pool,
so that connections to the same destination
are not parallelized, but instead queued.
If a queue is full, new messages are immediately
deferred, before mail data is sent from postfix.
Closes: #141
Signed-off-by: Jagoda Ślązak <jslazak@jslazak.com>
Log
`Unexpected EoF while receiving DATA!`
instead of
`Malformed DATA line without CRLF ending!`
Fixes: #165
Signed-off-by: Jagoda Ślązak <jslazak@jslazak.com>
There is a known bug that `quanta` clock
used by default sometimes jumps back:
<https://github.com/metrics-rs/quanta/issues/111>.
This results in `governor` rate limiter
incorrectly rejecting the messages
even when less than the configured burst size
has been sent.
Switched to standard monotonic clock
which does not have this problem.
I tested that this fixed the problem for me,
chatmail relay test `test_exceed_rate_limit`
stopped failing randomly.
Fixes <https://github.com/chatmail/filtermail/issues/166>
for bounces postfix sets Content-Transfer-Encoding: 8bit
which causes a quoted-printable conversion when filtermail SMTP does not offer 8BITMIME,
which in turn breaks DKIM verification.
If a reused connection was closed
in the meantime, open a new connection,
instead of failing immediately.
Fixes#143
Signed-off-by: Jagoda Ślązak <jslazak@jslazak.com>
Transport mode:
Implements an additional mail delivery
channel over HTTPS.
Incoming mode:
Adds a http server listening for
incoming messages delivered over HTTPS.
Signed-off-by: Jagoda Ślązak <jslazak@jslazak.com>
Implements a new mode "transport",
that allows filtermail to be used for
remote delivery.
In transport mode, filtermail listens for LMTP
connections, splits messages by domain
and performs delivery to remote MTAs over SMTP.
SMTP client tries to open socket on all resolved
addresses in parallel and uses one that succeeds
the first, fixing the issue described in:
chatmail/relay#900
Extends the built-in SMTP client
with STARTTLS support.
Extends the built-in SMTP server
with LMTP greeting support.
Groundwork required for mxdeliv endpoint
(HTTP channel for MTA-to-MTA communication):
chatmail/relay#900
Signed-off-by: Jagoda Ślązak <jslazak@jslazak.com>
BREAKING CHANGE: messages using domain-literal
addresses don't require to match the origin
SMTP connection IP anymore.
Signed-off-by: Jagoda Ślązak <jslazak@jslazak.com>
If the MAIL FROM doesn't match the From header,
we do not reject the mail, as this can be caused
by e.g. SRS forwarding. Instead, we reset the envelope
address, so it is reinjected as `MAIL FROM:<>`
to prevent sending a bounce message.
Closes#67
Signed-off-by: Jagoda Ślązak <jslazak@jslazak.com>
This way we won't be logging DKIM rejections on messages that
would be rejected anyway due to not being encrypted.
Fixes#69
Signed-off-by: Jagoda Ślązak <jslazak@jslazak.com>
`String::from_utf8_lossy` always copies the data
for the case when it needs to replace invalid UTF-8,
but we don't want invalid UTF-8 anyway as replacing
invalid UTF-8 characters will break DKIM signature.
Previously header parsing caused leading whitespaces to be
trimmed in HeaderBody, which resulted in incorrect simple
header canonicalization.
Signed-off-by: Jagoda Ślązak <jslazak@jslazak.com>
If the incoming email comes from address that uses
domain literals `[<ipv4>]` or `[IPv6:<ipv6>]`,
skip DKIM verification and instead check IP
alignment with originating IP from XFORWARD
command.
Signed-off-by: Jagoda Ślązak <jslazak@jslazak.com>
* feat!: DKIM verifier
This implements a DKIM verification as well as a strict
DKIM signature alignment check with domain in `From`
header address.
Caches the retrieved RDATA using in-memory LRU.
BREAKING CHANGE: incoming messages now require DKIM signatures
aligned to domain of the `From` header address.
Signed-off-by: Jagoda Ślązak <jslazak@jslazak.com>
* chore(license): License binaries under GPLv3
Signed-off-by: Jagoda Ślązak <jslazak@jslazak.com>
---------
Signed-off-by: Jagoda Ślązak <jslazak@jslazak.com>