Commit Graph
379 Commits
Author SHA1 Message Date
Tom Mairs 00df937be2 remove trailing dot 2026-09-18 13:59:51 +01:00
Wez Furlong 04df635508 ci: maybe add ubuntu 24.04 2026-06-27 18:45:08 +01:00
Roalt Zijlstra e352ca919a Fixed the regex with IP for apple provider with single quote x3 2026-06-23 16:29:04 -04:00
Roalt Zijlstra d4283e2f01 Updated more provider support. web.de and gmx.net are same provider. Added icloud/apple provider and some others. 2026-06-23 16:29:04 -04:00
Wez Furlong 2a657f68fb included scheduled queue config in resolve-egress-path output
and also in resolve-shaping-domain, for consistency.

We can use the message rate from the scheduled queue config to refine
the computed ceilings/constraints too, which is nice.
2026-06-23 10:00:07 +01:00
Wez Furlong 61bb95a558 resolve-shaping-domain: expand output
This changes the output to be a bit more human friendly by default
by rendering as toml.

It also includes the rate ceilings added in the prior commit.
2026-06-23 09:59:32 +01:00
Wez Furlong e21bb1c672 ha_proxy_server and socks5_proxy_server now also resolve host names
We'll expand these to a list of candidate addresses, trying each in
turn.  We use the same overall connect timeout regardless of how
many candidates are present, to respect that timeout bound.

closes: https://github.com/KumoCorp/kumomta/pull/402
2026-06-23 09:11:53 +01:00
Wez Furlong af6356419a find-since-dev: handle no-matching since('dev') case 2026-06-23 08:59:14 +01:00
Wez Furlong 40562f7824 deps: add cargo cooldown config 2026-06-17 22:55:32 +01:00
Harsh JhaandWez Furlong 00f3131f7d Allow configuring which records TSA skips
Closes: https://github.com/KumoCorp/kumomta/pull/525

Co-authored-by: Wez Furlong <wez@wezfurlong.org>
2026-05-29 15:02:31 +01:00
kay ozaki 7921fa5a19 typing.lua boolean-true default prevents mail_auth modules from being disabled
refs: https://github.com/KumoCorp/kumomta/pull/505
2026-04-29 12:06:35 +01:00
sophiajtandWez Furlong 62b62560de Start of DMARC reporting
The start of reporting support for DMARC. We create the report from the
errors we encounter, though we do not yet have this wired into the email
reporting system.

Our main task is collecting the errors, though where we put them still
needs to be decided. Currently, a temporary file is used.

Once collected, the errors can be aggregated and built into the RFC 7489-compliant report.

Co-authored-by: Wez Furlong <wez@wezfurlong.org>
Closes: https://github.com/KumoCorp/kumomta/pull/463
2026-04-29 08:07:55 +01:00
Wez Furlong baa95fbbb0 log_hooks: add optional pre-filter function
This is useful if your hooks have interior logic to decide to
filter out a given record.  For example, you might have multiple
hook endpoints but only messages with certain headers/metadata
should be routed to any one of them for a specific event.

Without the ability to pre-filter, we need to pay the cost of
spooling the event speculatively, and then skipping it when
processing logging for the (hopefully!) batch.

Using pre-filter you can cut out that overhead.

This is not yet documented; we're getting this in to get
some feedback before we finalize this interface.
2026-04-03 09:50:13 +01:00
Wez Furlong 6479810368 queue helper: add invalidate_with_epoch option to queue_helper_data cache 2026-04-02 08:55:13 +01:00
Mike Hillyer 6ac3df137d Updating API index in refman to reflect changes to ACL. 2026-03-27 12:48:28 -04:00
Wez Furlong 4bd063f246 resolve-xxx: allow use with http:// special tsa/xfer queues
These utilities would simplistically assume that the input domain
was always a valid DNS name, which is true for the majority of
things, but our internal webhook, TSA and xfer queue names include
http URLs and would choke these utilities.

We now fall back to using the input "domain" if the MX resolution
attempt throws an error; the error is typically a failure to parse
rather than something like NXDOMAIN which is generally returned as an
empty result.
2026-03-16 08:20:47 +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 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 7a18a11e48 add helper script for cutting a release
This saves me some time updating the docs, and is more important
now that we use that since macro in rust crate source too.
2026-03-04 08:01:10 +00:00
Wez Furlong ead20faa0f tsa: ensure that we have the status endpoint in the default ACL 2026-03-03 19:39:20 +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
Daniel Smith 9dd4078c44 update rules for orange 2026-02-23 13:57:24 -05:00
Daniel Smith ecc2d09d01 update community shaping to use providers 2026-02-23 13:57:24 -05:00
Wez Furlong 11e952fa98 shaping.lua: stylua format 2026-02-20 08:08:38 +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 4055c50522 authz: introduce an ACL facility
This commit is a step towards some general improvements around
our handling of authentication and authorization.

This commit is focused primarily on authorization, but there are
some adjustments to how we track authentication as part of enabling
that.

We now have a separate AuthInfo type that holds the overall
authentication information/context associated with an inbound
SMTP or HTTP session.

It is populated with the peer_address as a fact rather than a statement
of trust.

If authentication via the appropriate lua auth callback is successful,
then the AuthInfo has additional identities added.

There are some types and events for loading access control lists and
matching their rules against an AuthInfo.

There is now a system default ACL that is equivalent to the prior
hard-coded access policy that was encoded into each HTTP endpoint.

This change makes it possible to replace the ACL with a
user-defined ACL.

Later will be some work on authentication to allow more options
for HTTP auth.
2025-12-18 06:30:06 +00:00
Daniel Smith 9738d2913b add some rules and divide other rules into appropriate labels 2025-12-04 14:56:34 -05:00
Wez Furlong d47e280b9a ci: pruning in the builder images 2025-11-25 13:14:56 +00:00
Wez Furlong a76857cffb ci: try alternative way to install the rust-toolchain version
This should avoid having two different versions of the toolchain in the
common case, and reduces the size of the builder image.
2025-11-23 10:21:00 +00:00
Wez Furlong 7b583047d2 ci: pre-download the rust-toolchain version in the builder image 2025-11-23 10:04:45 +00:00
Wez Furlong 0b2c7871b6 ci: improve deb package compression performance 2025-11-23 09:56:30 +00:00
Wez Furlong cc03878c23 ci: adjust builder sccache build for amazonlinux:2
It doesn't like the full sccache build due to some wonkyness
with openss on this old distro.

Let's just pave over this by not enabling the full build
on that platform.
2025-11-22 21:44:41 +00:00
Wez Furlong 3c75f92d76 ci: re-enable sccache default features
At some point turning off most features used to make things work in our
environments, but looking at things today, I think it basically makes
it do nothing useful any more.

Turning things off just made the image build a hair faster and the
image a hair lighter.

So let's just turn it back on
2025-11-22 21:26:53 +00:00
Wez Furlong 7ac9a5eac0 smtp_dispatcher: handle pathologic all-452 case
Continuing in the same vein as 94628f06ab,
ensure that we have a reasonable outcome when a batch of size > 1
encounters 100% ambiguous 452 responses.

Without special consideration we'd end up in an infinite retry loop for
these, as we'd think that we'd hit the recpient limit on the connection
every time.

This commit introduces a small amount of state into the dispatcher so
that we can remember the set of (spoolid, recipient) from the prior
transaction on the session.

When deciding whether something is eligible for immediate retry
we will gate that choice on the current (spoolid, recipient) being
absent from the prior set of ids.  In this way, we bound the immediate
retry for a recipient to one per connection.

To make things a bit more robust when trying to decide whether a 452
means "too many recipients" or not, if we're not sure, we now call out
to the bounce classifier which can be configured to emit a
`TooManyRecipients` classification.  If the classifier produces either
that or some non-Uncategorized response, then we have a confident
assessment.  Otherwise, we're unsure and will factor that into the
retry strategy.
2025-11-07 08:13:36 +00:00
Sophia Turner 96bdbef106 add a dmarc lua test, fix API 2025-11-07 08:08:29 +00:00
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 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 db5ebb88a7 message: expose recipient list to lua api
message:recipient() may now return an array style table
holding the recipient list, if there is more than a single
recipient on the message.

Since this can be somewhat ambiguous/frustrating to work with,
there is now also a message:recipient_list() that will always
return an array style table, even if it holds just a single
element.

The included helpers have been updated to use `message:recipient_list`.

message:set_recipient() will now optionally accept an array
style table holding the recipient list to be set.
2025-10-07 07:52:58 +01:00
Wez Furlong 53a6bc3b7e log_hooks: add helper for creating a disposition hook 2025-09-09 10:39:52 +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 c28560b4f5 run-lua-test: fixup when run as root (eg: in CI)
Need to pass `--user` in that case
2025-08-11 14:21:02 +01:00
Wez Furlong 9f316ed689 ci: improve run-lua-test
This commit:

* Adds auto-discovery of both module style and crate style tests
* Runs each test via its own instance of `kumod`, so that one test
  cannot pollute the state of another
* Runs all lua tests concurrently
2025-08-11 13:24:41 +01:00
Wez Furlong 7e6ca34e2d new: kumo.fs lua module
The read_dir and glob functions have been logically moved into that new
namespace, leaving deprecated versions of them in the `kumo` module.

A new `kumo.fs.open` function that works similarly to `io.open` is
provided.  This function cooperates with the kumo async io scheduler
and won't block it if the filesystem is under pressure.

It returns file handles that are simlar to the builtin lua file handle
objects, but do not support formatting or parsing of writes or reads
respectively: the calling code is responsible for that.  The rationale
for this difference is that is that lua's semantics for those functions
are frankly a bit weird and are hard to replicate precisely.
2025-07-23 16:51:06 +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
kayozakiandWez Furlong a7315633de add kumo.dns.lookup_ptr (#390)
* add lookup_ptr

Co-authored-by: Wez Furlong <wez@wezfurlong.org>
2025-07-22 08:45:27 +01:00
Mike Hillyer 58e9770206 We miss you Mister Rogers. 2025-07-18 12:11:14 -04:00
Mike Hillyer 41d251f20d Update links to Comcast docs 2025-07-14 12:19:40 -04:00
smsvip 76f2e833c2 Update shaping.toml
"gmail.com".automation --> regex = "Our system has detected an unusual rate"   

This item is repeated, although it will be override .
2025-07-01 13:11:09 +01:00
Mike Hillyer c7daa01ef2 Whoops, already required. 2025-06-11 18:34:05 -04:00
Mike Hillyer 748c700c7b Adding TLS required for Comcast as per @AlexB in the Discord. 2025-06-11 18:29:38 -04:00