Commit Graph
535 Commits
Author SHA1 Message Date
Wez Furlong 4c6d7ca8ea add policy-extras.mail_auth module
This aggregates the various authentication-results producing auth checks
into a more convenient function.

Part of this change improves some plumbing in the dkim checking (we no
longer raise an error for a missing From, but instead indicate a failed
dkim result), and we now support passing down a resolver name to the
various checking functions, to facilitate testing and other more
advanced use cases.

refs: https://github.com/KumoCorp/kumomta/issues/16
refs: https://github.com/KumoCorp/kumomta/issues/84
2025-11-02 11:56:57 +00:00
Wez Furlong 49cdee1ec5 lruttl: expose pre-defined cache info to the docs
This commit adds some plumbing to allow us to collect metadata
about the caches and spit it out into a json file that we can
then use in the docs to show the predefined caches, capacities
and brief comments about their purpose.

We put that info on the set_lruttl_cache_capacity doc page.
2025-11-01 07:40:40 +00:00
Wez Furlong e7f4806f1b dkim: add integration test assertions for signing cache
refs: https://github.com/KumoCorp/kumomta/pull/438
2025-10-31 17:27:05 +00:00
Wez Furlong 5ad7df0203 arc: expose arc_seal and arc_verify methods to lua
refs: https://github.com/KumoCorp/kumomta/issues/16
2025-10-31 12:16:32 +00:00
Wez Furlong 823ee09db9 dkim: refactor and improve some of the test logic
refs: https://github.com/KumoCorp/kumomta/issues/16
2025-10-31 12:16:31 +00:00
Wez Furlong 6adb43221f Expose text wrapping function as kumo.string.wrap
Extracts the wrap function to its own little crate and expose that to
lua.
2025-10-29 12:06:06 +00:00
crx 5132f87b96 Feature/traffic-gen custom headers (#434)
* traffic-gen: add support for --header
2025-10-24 09:08:42 -07:00
Wez Furlong 6f31d5514c new Time and TimeDelta objects for lua
Motivated by https://github.com/KumoCorp/kumomta/pull/403,
this commit introduces reasonably full featured Time and TimeDelta
types built atop the chrono crate.

closes: https://github.com/KumoCorp/kumomta/pull/403
2025-10-22 17:26:35 +01:00
Dario MaiocchiandWez Furlong 847cc21e9b implement aes-cbc block with examples
Add CBC and ecb Block mode aes encryption/decryption.

To facilitate testing this better, and just to be nicer overall, adjust
data-loader's KeySource::key_data variant to support loading raw binary
bytes.

Co-authored-by: Wez Furlong <wez@wezfurlong.org>

Closes: https://github.com/KumoCorp/kumomta/pull/395
2025-10-22 11:55:16 +01:00
Sophia Turner 30fb024eab Add psl to dmarc relaxed checks 2025-10-15 10:52:25 +01:00
Wez Furlong b73d81b0fc dns: utilities and plumbing for querying DNSBLs
This commit does some plumbing work to allow defining alternative
resolvers with different names that can be used to query different
upstream DNS servers.

This is most useful when implement DNSBLs where you might have a custom
DNS server configured with one or more RBL zones that is reserved purely
for RBL lookups.

The plumbing introduces a more regular syntax for defining one of the
various implementations of the Resolver trait, as well as a new
Aggregate resolver impl that can query across multiple Resolvers until a
query is satisfied.

This allows some interesting and powerful configurations, such as
loading a static zone file into memory to query it directly, and/or
blending that together with querying either the system or some other
upstream DNS server as a fallback.

The various lookup functions (except for MX!) have been updated to
accept an optional alternate resolver name, so that they work together
with the above.

A new rbl_lookup function is also provided as a convenience for querying
the most common form of RBLS.

ptr_host and reverse_ip are two string utility functions that are likely
not going to be widely used, but are very convenient to have when you
do have a usecase that requires it!

closes: https://github.com/KumoCorp/kumomta/issues/269
2025-10-10 18:45:52 +01:00
Wez Furlong 32763a98b8 kcli provider-summary: dedup domains in domains list 2025-10-10 18:45:51 +01:00
Wez Furlong 24602cff44 ci: reduce flakeyness in xclient test
I noticed a test failure where we hadn't yet received all of the
trace events that we wanted to inspect, so this commit introduces
the ability to wait for matching records to appear in the collected
set of data.
2025-10-09 09:12:41 +01:00
Wez Furlong 3236cc2a1e deps: revert rocksdb upgrade
There's some kind of bad linker issue in CI that will take a little
bit to run down, and the update wasn't critical, so let's rever it
for the time being.
2025-10-09 07:40:29 +01:00
Wez Furlong 1621c18ad4 deps: mlua 2025-10-08 11:26:56 +01:00
Wez Furlong 605867b0d2 deps: which 2025-10-08 11:08:47 +01:00
Wez Furlong fda9285212 deps: sqlite, strum, testcontainers-modules 2025-10-08 11:06:53 +01:00
Wez Furlong 2f155595aa deps: update thiserror, toml 2025-10-08 11:02:36 +01:00
Wez Furlong 9c3ec1f16e deps: update rdkafka 2025-10-08 11:00:37 +01:00
Wez Furlong bb80da6023 deps: update redis 2025-10-08 10:58:10 +01:00
Wez Furlong 3b0635e075 deps: update rocksdb and jemalloc 2025-10-08 10:55:09 +01:00
Wez Furlong 17158cb960 deps: update a few more 2025-10-08 10:52:55 +01:00
Wez Furlong 687f83e42e deps: update criterion 2025-10-08 10:43:12 +01:00
Wez Furlong 2ac85f51ff deps: cargo update 2025-10-08 10:39:00 +01:00
Wez Furlong 8028a8aaf0 deps: update prometheus and metrics crates 2025-10-08 10:34:56 +01:00
Wez Furlong 8fc11713d8 deps: update axum and utoipa ecosystem crates
A "casualty" of this is that the client-ip crate, which we were using
for its InsecureClientIp type for informational purposes, has retired
the InsecureClientIp type because it wasn't trustworthy overall
(https://github.com/imbolc/axum-client-ip/issues/32).

What we do for the time being is configure that crate to use the direct
peer IP.  There isn't a way to automagically select the "best"
information available without building in some kind of middleware, and
we probably should make that configurable in order to be fully
trustworthy.

So for now, we're punting on that until someone shows up with some
requirements and sponsorship and we'll make it happen then.
2025-10-08 10:24:57 +01:00
Wez Furlong 4be75084e1 deps: paste -> pastey
The paste crate is unmaintainted, pastey is a maintained fork:
https://rustsec.org/advisories/RUSTSEC-2024-0436
2025-10-08 09:37:31 +01:00
Wez Furlong 5c98511c06 add new kumo.file_type module
This is useful for example when processing attachments as part of a
content scanning policy.
2025-10-07 12:12:46 +01:00
Wez Furlong 7f4a929ca2 message transfer (xfer) support
This commit implements a kumomta-specific message transfer
protocol that is intended to be used to migrate messages
from one kumomta node to another.

The transfer is carried out using an HTTP POST request
to the destination node's http listener.

The request includes the full message metadata and body,
in a compressed form.

An xfer request can be made via `kcli xfer` (and thus also via an HTTP API
endpoint).  It works similarly to a rebind operation; you specify the
criteria to be used to match scheduled queues, along with the target
node for the xfer, and kumomta will find matching queues, drain out the
messages, make an adjustment to the metadata to capture current
scheduling information, and then place the messages into an xfer queue.

The xfer queue has hard-coded scheduling queue configuration of its own,
with the base retry interval set to 10 seconds, which should be suitably
aggressive for the intended use case.

You may apply shaping to affect the number of concurrent requests in a
similar way to how TSA shaping is configured.

On the receiving side, the incoming xfer sanity check to prohibit
trying to xfer to itself.

The spool id of the Message is not suitable to be reused verbatim on
another node (spool ids include the local mac address and creation
timestamp information, as well as a random component), so the receiving
side will derive an id that should be suitable for use on that node.
The originating node id and spool id will be preserved in metadata to
aid in tracing.

It is possible for an xfer request to target an existing xfer queue, so
that you can correct/update the target in various circumstances. In that
situation the messages will be "simply" moved from the source queue to
the destination queue.

It is possible to cancel an xfer request via `kcli xfer-cancel` (and
thus also via an HTTP API endpoint).  You specify the target queue,
which must be an xfer queue, and it will have its messages drained and
the metadata changes that were applied when the xfer was initiated will
be reversed, allowing the messages to then be reinserted into their
originating queue.

refs: https://github.com/KumoCorp/kumomta/issues/311
2025-10-07 10:58:07 +01:00
Wez Furlong 9079a9e569 WIP: more multi-recipient type changes
This commit updates the type signatures of some key structures
to allow for the possibility of a Message having multiple recipients:

 * Message (continuing from previous commit)
 * JsonLogRecord
 * MessageInformation

Some logic has been updated to account for multiple recipients,
but critically, nothing in the core will generate them, and none
of the queue management or delivery infrastructure is aware
of recipients beyond the first.
2025-10-07 07:52:57 +01:00
Wez Furlong 055a2d0086 message: allow for multiple recipients in metadata 2025-10-07 07:52:56 +01:00
Wez Furlong 206dc7c7fa optionally detect legacy 8-bit during check-fix 2025-10-07 07:50:46 +01:00
Sophia J. TurnerandSophia Turner 5ec871ab04 Add support for dmarc pct (#424)
* Add support for dmarc pct
* address feedback

---------

Co-authored-by: Sophia Turner <sophiajt@users.noreply.github.com>
2025-10-06 23:26:16 -07:00
Sophia Turner 19e80001cd Address feedback 2025-09-30 07:13:12 +01:00
Sophia Turner 1853f1be88 Initial DMARC support 2025-09-30 07:13:12 +01:00
Wez Furlong eb54cc74d9 proxy-server: raise NOFILE soft limit to match hard limit
This makes the startup behavior consistent with kumod and tsa-daemon,
which can help with "Too many open files" errors in systems without
any explicit tunings for the proxy server.

It is still a good idea to explicitly tune that value up, and it is
something we should put into a systemd unit when we get around to
shipping one of those for the proxy server (#188)
2025-09-18 15:54:18 +01:00
kay ozaki 934a8eebab adding crc32
closes: https://github.com/KumoCorp/kumomta/pull/404
2025-09-09 14:35:48 +01:00
Wez Furlong 7fffccf410 Add support for generating NDRs
This commit adds some plumbing to facilitate generation of RFC 3464
non-delivery reports and some corresponding glue to enable calling
it from lua.

Examples in the docs that are also added.
2025-09-09 14:12:52 +01:00
Wez Furlong 1bf9d138ce extended lua mime parsing API
refs: https://github.com/KumoCorp/kumomta/issues/117

Could also make it possible to do eg:
https://github.com/KumoCorp/kumomta/issues/142
without any explicit direct support in the product.
2025-09-09 09:15:58 +01:00
Wez Furlong 89c24e58cd cargo update
closes: https://github.com/KumoCorp/kumomta/pull/415
2025-09-02 07:33:23 +01:00
Wez Furlong 636bdd7304 cargo update 2025-08-13 07:15:59 +01:00
Wez Furlong f85094282f migrate run-lua-test to rust
At least one of our supported platforms doesn't have a new enough
python to run the python version, let's just use rust for this.
2025-08-13 07:09:53 +01:00
Wez Furlong bc7c95b42a docs: changelog for #394 2025-07-25 06:02:57 +01:00
Daniel Schaaff 25a292a82e add support for compressing http body (#394)
* implement support for compression in common http server code

Adds a decompression layer to enable receipt and automatic decompression of compressed request bodies.

Signed-off-by: Daniel Schaaff <daniel@danielschaaff.com>
2025-07-25 05:56:12 +01:00
Wez Furlong 9e62a275c5 add tls_required_client_ca esmtp listener parameter
This enables configuring mTLS support in the listener.

Adjust TLS client tests to use this on the sink side and verify
that mTLS works for both inbound and outbound SMTP.

refs: #100
refs: #391
2025-07-24 15:40:49 +01:00
Wez Furlong c8027effb6 smtp_server: collect incoming tls information for logs/meta
This commit extracts the TLS version, cipher and subject name from
the TLS state and captures it:

* In the trace headers
* In the connection metadata
* In the Reception log record

In order to capture the info in trace headers, this commit will
now change the reception protocol to ESMTPS (for SSL) or ESMTPSA (for
authenticated SSL), and emit the version and cipher information as
a comment like: `with ESMTPS (TLSv1_3:TLS13_AES_256_GCM_SHA384)`.

closes: #100
2025-07-24 13:01:13 +01:00
kayozaki 76add2ced5 Adding support for presenting Client cert as part of make_egress_path (#391) 2025-07-24 13:00:27 +01:00
Wez Furlong 7d617bb270 add kumo.mpsc.define
This function allows defining a non-durable, non-persistent, in-memory
queue that is intended to be used as glue when building up more advanced
processing flows within kumomta.

The intent is that the queue is processed from within a task spawned via
`spawn_task`.
2025-07-23 12:44:10 +01:00
Wez Furlong ca4593b284 cargo update 2025-07-22 08:45:39 +01:00
Wez Furlong c914f9b045 dns-resolver & EnvelopeAddress: explicitly check and deny ports in domain
This is prep work ahead of https://github.com/KumoCorp/kumomta/issues/352

This commit adds an explicit check for port numbers being passed in
via the domain when setting envelope addresses.

This is forbidden by the SMTP spec. This commit adds an explicit
integration test to confirm that we're reject them there.

For HTTP injection we don't have any other central point to
validate addresses, so this commit expands on the EnvelopeAddress::parse
method to add that centralized check.

dns-resolver's domain name validation is refactored into a domain
name classifier to help reuse that same logic outside the context
of making an actual DNS lookup.

MailExchanger::resolve is now also explicitly checking for and denying
lookups that include a port number.

This commit should have no practical functional impact; all of the
things denied by these checks are illegal in SMTP.
2025-07-21 12:30:29 +01:00