Commit Graph
1464 Commits
Author SHA1 Message Date
Wez Furlong 084389b7ae dkim: remove implicit policy status for mismatching From/Signing domains
It was pointed out that we had this policy and that it wasn't part of
the spec.

That behavior was imported along with the crate when we forked it from
the cloudflare implementation.

Let's remove it; folks that need it can use a couple of lines of lua to
recreate it if they need it.
2026-03-28 07:20:08 +00:00
Mike Hillyer 8d2966727b Link tweak. 2026-03-27 12:50:40 -04:00
Mike Hillyer 6ac3df137d Updating API index in refman to reflect changes to ACL. 2026-03-27 12:48:28 -04:00
Wez Furlong d48ad3cb5b mod-serde: sort pretty-printed json object keys
This makes things a bit easier for human consumption, especially
for the `resolve-shaping-domain` utility.
2026-03-16 08:35:00 +00:00
Wez Furlong c0440ea138 rfc3464: fix issue with addresses enclosed in <>
This is a follow on from the previous commit; apparently some sites
will enclose addresses in <> even though this is not covered in the
RFC.

Let's cut the address parsing over to the SMTP parser rather than
the mail header parser, as they have rather different semantics
and both ARF and OOB are SMTP-centric.
2026-03-16 08:06:35 +00:00
Wez Furlong 813c7935d6 rfc5965: fix an issue with addressed enclosed in <>
We had a report that the enclosing <> were being passed through
to the JsonLogRecord in some log hook flows, which meant that
we'd try to parse them as EnvelopeAddresses and fail.
2026-03-13 10:36:36 +00:00
Raphael Sprenger aaf7f3fcce use correct option add_auth_results_header
Updating the wrongly stated "add_authentication_results" to the correct "add_auth_results_header" in check.md.
2026-03-13 07:23:12 +00:00
Wez Furlong 1c5221ba00 add /api/admin/task-dump api endpoint
This dumps out a trace of all tokio tasks.  It is quite expensive,
and currently unsettles the tokio runtime such that you need to
repeatedly call this endpoint in order for a subsequent graceful
shutdown to clock through and complete.
2026-03-11 15:19:23 +00:00
Wez Furlong c151016472 lruttl: add consistency/robustness check
In our thundering herd protection we intentionally limit the number of
pending lookups for a given key to just 1.  That is controlled via
a semaphore.

We have pre-existing logic that checks to see if the semaphore has been
closed (eg: by a task being cancelled), but despite this, we do
occasionally have reports from users with `timed out after 120s on
semaphore acquire while waiting for cache to populate` for the shaping
data cache.

This typically correlates with eg: long IO waits due to eg: a spike in
transient failures and usually some sort of logging of headers, but not
always.

The not always situation bothers me as we don't currently have a good
explanation of what might be causing the excessive delay.

This commit adds an additional sanity check: when a new lookup is
initiated, if the semaphore is still open (not cancelled), but has been
open for longer than the populate timeout, then we treat this similarly
to the semaphore being closed: we'll create a new semaphore, reset the
expiration and the caller will typically then promote itself to the task
that will satisfy the lookup.

The side effect of this all waiters should become unblocked and awake
either with an error status or with the result of the new lookup, which
should help to clear any persistent/recurring blocking state associated
with this.

This change doesn't provide more insight (I have something in mind for a
follow-on commit for that), but should help make forward progress.
2026-03-11 15:19:23 +00:00
Wez Furlong e4594e8550 sources.lua: fix defining empty egress pools
The example in the FAQ does this but it did not validate because the
associated structure was not defined, because there were no sources
in the pool!

Fix up the logic to allow creating an empty pool.

https://docs.kumomta.com/faq/how_do_i_create_an_always_suspended_queue/
2026-03-05 16:57:51 +00:00
Wez Furlong 654f9b88f5 new: ip_lookup_strategy option in make_egress_path
This provides control over IPv4 and IPv6 lookups based on the source
and/or destination.
2026-03-04 16:33:32 +00:00
Wez Furlong 4eef49df3c docs: remove suspended option from docs
This was removed from the product over a year ago in
16fb1ae316
2026-03-04 15:14:50 +00:00
Wez Furlong 332595ee2a queue.lua: add typing to setup methods
We had an issue where a typo resulted in a relatively inscrutable
error at runtime:

```lua
local queue_helper =  queue_module:setup ('/opt/kumomta/etc/policy/queues.toml')
```

produced this:

```
problem initializing: call validate_config callback: runtime error: /opt/kumomta/share/policy-extras/queue.lua:602: bad argument #1 to 'for iterator' (table expected, got nil)
stack traceback:
        [C]: in function 'next'
        /opt/kumomta/share/policy-extras/queue.lua:602: in function </opt/kumomta/share/policy-extras/queue.lua:551>
Error: Initialization raised an error: call validate_config callback: runtime error: /opt/kumomta/share/policy-extras/queue.lua:602: bad argument #1 to 'for iterator' (table expected, got nil)
stack traceback:
        [C]: in function 'next'
        /opt/kumomta/share/policy-extras/queue.lua:602: in function </opt/kumomta/share/policy-extras/queue.lua:551>
```

with the changes in this commit we'll present this issue like this,
during server startup, which points a little more clearly at the setup
call and the file names parameter, and suggests more strongly that it
should be a list of strings (or config objects):

```
    runtime error: [string "./simple_policy.lua"]:52: assets/policy-extras/queue.lua:463 QueueHelperSetup: invalid value for field 'file_names'
    assets/policy-extras/queue.lua:463 Expected value of type 'list<variant<string,QueueHelperConfig>>' but got type 'string' '/opt/kumomta/etc/policy/queues.toml'
    stack traceback:
        [C]: in function 'error'
        assets/policy-extras/typing.lua:78: in method 'raise'
        assets/policy-extras/typing.lua:249: in metamethod 'newindex'
        assets/policy-extras/typing.lua:258: in function <assets/policy-extras/typing.lua:253>
        (...tail calls...)
        assets/policy-extras/queue.lua:463: in function 'policy-extras.queue.setup_with_options'
        (...tail calls...)
        [string "./simple_policy.lua"]:52: in main chunk
```

this change actually surfaced a minor issue in the ndr.lua file that is
part of an integration test, as well as in my adhoc simple_policy file.
2026-03-04 09:23:08 +00:00
Wez Furlong 030520b04c docs: update changelog for stable release 2026-03-04 08:05:09 +00:00
Wez Furlong 93e8e7dd01 docs: update since('dev') macros for stable release 2026-03-04 08:03:21 +00:00
Wez Furlong bb93ecb17e log_record.md: add a couple of missing log record types 2026-03-04 07:47:07 +00:00
Wez Furlong b3c72e97d3 log_record.md: note about how size can be reported as zero 2026-03-04 07:40:57 +00:00
Wez Furlong e4650a22e5 docs: fix minor typo in access_control.md 2026-03-04 07:39:05 +00:00
Mike Hillyer c4c161543f Typo. 2026-03-03 13:53:31 -05:00
Wez Furlong 7d521fd493 docs: clarify enable_mta_sts 2026-03-03 17:19:25 +00:00
Aditya Ganti f0e48bdb27 dkim: fix wrapping issue
It was reported that AWS SES could mark the DKIM signature as failed
when using a specific combination of headers in the header list,
with specific lengths of the other fields.

The reason for this is that we had two passes of wrapping applied
to the header, and they might not agree on the formatting of
the header.

The solution is to remove the second pass and just take a bit more
care to emit the header in a wrapped form in the first instance,
that way there can be no discrepancy or conflict.

closes: https://github.com/KumoCorp/kumomta/pull/483
2026-02-28 08:17:09 +00:00
Wez Furlong 04076707ec http injection: template errors are now reported with status 422
As part of this, we move template compilation to happen before
we queue up deferred generation; the compilation step should
be plenty fast enough that we can reasonably do that synchronously
and report any compilation errors back to the peer.
2026-02-25 14:25:38 +00:00
Wez Furlong b018f8f128 machine-info: add docs/examples to jsonschema 2026-02-24 13:59:18 +00:00
Wez Furlong 2d1a31741f docs: add a page discussing the Node ID 2026-02-24 12:59:00 +00:00
Wez Furlong d8a7b0170e add new cpu usage metrics
refs: https://github.com/KumoCorp/kumomta/issues/186
2026-02-24 12:19:54 +00:00
Wez Furlong 9bd3a5da23 introduce kumo-machine-info crate
This crate queries machine/system information which is intended
to be used in system monitoring.

This information is not centrally collected or retained by kumocorp,
merely reported via an API endpoint which is accessible only to trusted
IPs.

Machine info tries to interrogate information about the running/hosting
cloud platform for the major cloud providers, as well as indicate
whether it is running in a container of some kind.

The full cloud information is not re-exported via the API endpoint at
this time, but a fingerprint that encodes things like the instance-id is
included.
2026-02-24 12:19:53 +00:00
Tobias HorstandWez Furlong 719e140f0e mod_nats: integrate nats
Publish messages using the jetstream client.
Supports password and token authentication.

Co-authored-by: Wez Furlong <wez@wezfurlong.org>
Closes: https://github.com/KumoCorp/kumomta/pull/449
2026-02-24 11:03:43 +00:00
Wez Furlong 9847867dc4 smtp_dispatcher: improve dead connection detection between sends
This is an alternative implementation of
https://github.com/KumoCorp/kumomta/pull/482 that checks for a
unilateral response as part of deciding whether we can re-use
the current connection.

By detecting this condition before we've popped a message, we avoid
classifying that message attempt as a transient connection failure, and
can send it with lower latency overall.

closes: https://github.com/KumoCorp/kumomta/pull/482
2026-02-21 07:25:40 +00:00
Wez Furlong 80decbc08e redis: add redis_operation_latency histogram
This enables tracking the latency and status of redis operations.
2026-02-20 08:15:09 +00:00
Wez Furlong 5f7fae1d6b tsa: add basic /tsa/status endpoint
This simply returns a 200 response and can be used to determine
that TSA service is up.
2026-02-20 06:51:23 +00:00
Wez Furlong 26135a2b53 filter out not-relevant-to-TSA events earlier in the logging
I believe this to be more of a micro optimization, because the
heavy lifting was already being done in the should_enq function,
which filters out before we commit the event to the spool.

Thanks to @smsvip for noticing that there was a discrepancy
between the UNINTERESTING_LOG_RECORD_TYPES and the per-record
configuration; we now use the former to derive the latter.

I've add more obviously irrelevant to TSA types to the config
as part of this commit.

refs: https://github.com/KumoCorp/kumomta/pull/481
refs: https://github.com/KumoCorp/kumomta/issues/478
2026-02-18 15:05:18 +00:00
Wez Furlong b2b3889077 docs: changelog for #480 2026-02-16 11:04:27 +00:00
Wez Furlong 6193331a4a http/xfer injection: grab Activity handle for duration of request
I noticed that we weren't grabbing the Activity handle for injection
requests.  Doing so allows us to reject a request that comes in
while we are shutting down the service, rather than accept it to
have it potentially dropped as we shut down.

I also realized that we need to make the xfer injection handler
match the same set of rules for the http injection handler, so
this commit refactors that logic to reuse it in both places.
2026-02-11 06:17:17 +00:00
Wez Furlong 188356e64d http injection: fix early startup race condition w/ spool
If you start up while injectors are actively trying to send,
you might trigger a race condition where the spool isn't fully
assigned by the time that an injection request wants to store
a message to the spool.

Add a similar check for spool readiness to what we have in
the smtp server path.
2026-02-10 06:57:01 +00:00
Wez Furlong c9ae7b5fed docs: changelog for #472 2026-02-06 07:35:00 +00:00
Wez Furlong 1690e6526a refactor: move start_proxy_listener to proxy module
We're keeping a reference to it via kumo.start_proxy_listener briefly,
just in case someone is using that live somewhere.

We don't need to changelog this, as this whole feature hasn't
been in a stable tag yet.

refs: https://github.com/KumoCorp/kumomta/pull/472
2026-02-06 07:31:30 +00:00
Wez Furlong 37111c8036 add auto-gen docs for proxy-server http api and metrics
refs: https://github.com/KumoCorp/kumomta/pull/472
2026-02-06 07:11:56 +00:00
Aditya GantiandWez Furlong f898e2a7e6 Add Prometheus metrics to proxy-server
Co-authored-by: Wez Furlong <wez@wezfurlong.org>

closes: https://github.com/KumoCorp/kumomta/pull/472
2026-02-06 07:11:27 +00:00
Wez Furlong 4f636a0fae skip_hosts: downgrade to a transient failure
This is a conceptually breaking change, but shouldn't be harmful
in practice.

Recently, Microsoft hosted domains have had a number of incidences where
the DNS stopped returning IPv4 addresses, which lead to systems that
employ skip_hosts to disable their IPv6 addresses (presumably due to
difficulties in warmup and reputation) to trigger the terminal case
where we would sweep the ready queue away as a permanent routing
failure.

In the context of a transient failure to route ipv4 the permanent
disposition was surprising and unwanted so it feels better to make
the effect of this situation more closely map to how we handle the
case where no MX records are returned.
2026-02-04 13:12:14 +00:00
Wez Furlong 87b64c8d2b docs: flesh out docs for a number of metrics
Give some suggestions on how to interpret a number of the metrics,
as well as cross linking to relevant documentation for them.
2026-02-04 11:45:11 +00:00
Wez Furlong 5efbc8d7c3 docs: link to metrics index from http metrics endpoint docs 2026-02-04 09:10:25 +00:00
Wez Furlong 66e5aa5508 docs: generate a page for each exported metric 2026-02-04 09:10:25 +00:00
Wez Furlong 828eb68017 tsa: fixup json schema
This makes it possible to load the schema with utoipa's parser.
This will be useful in the next commit which adds generated
docs to the doc build.
2026-02-03 12:23:17 +00:00
Wez Furlong 5d8708daa9 docs: fix typo in the xfer injection endpoint docs 2026-02-03 08:29:11 +00:00
Wez Furlong a1014b952f docs: recurse into anyof elements in jsonschema
This allows showing eg: the XferProtocol::target field inline in the
xfer docs.
2026-02-03 08:29:11 +00:00
Wez Furlong c5a6a1fb00 Adjust docs based on code review 2026-02-03 08:29:00 +00:00
kay ozaki bf6f9104dc exposing memory config parameters 2026-02-03 08:29:00 +00:00
Wez Furlong f53ed1aeae add kumo.xfer.xfer_in_requeue for xfer during requeue
Ordinarily, the logic that calls the requeue_message event is
responsible for increasing the number of attempts, computing the revised
due time, and processing message expiration.

When using XFER to move a message to another node, we capture the
scheduling state at the point that the xfer was initiated.

If we do this inside the requeue_message event callback then we will
capture the scheduling information *prior* to the normal adjustments
that would happen later.

This commit adds kumo.xfer.xfer_in_requeue to handle this case; you pass
through the scheduling information parameters that were added to the
requeue_message event in the prior commit, and it will compute any
revised scheduling for the message before wrapping the message up
in the XFER encapsulation and moving the message to the xfer queue.

This adjusted process ignores message expiration, so if the message
is on its last retry it will be xfer'd to the target host which then
might choose to perform the expiration.  We can't handle the expiration
in the context of `requeue_message` because the event handler doesn't
own the message and has no way to signal that it has reached the end of
its life.

Folks doing xfer in requeue_message will generally be moving the message
well in advance of it being expired, so this minor limitation is not
expected to be a practical problem.
2026-02-02 15:21:43 +00:00
Wez Furlong 722cd85e82 expose more details to the lua requeue_message event 2026-02-02 15:11:15 +00:00
Wez Furlong b963a5b6a8 docs: clarify that api_xfer_inject_v1_post is an internal api 2026-02-02 13:28:00 +00:00