Commit Graph

90 Commits

Author SHA1 Message Date
Wez Furlong 93e8e7dd01 docs: update since('dev') macros for stable release 2026-03-04 08:03:21 +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
Aditya Ganti 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 722cd85e82 expose more details to the lua requeue_message event 2026-02-02 15:11:15 +00:00
Wez Furlong d6eb5176ad docs: remove rapidoc HTTP explorer
It has been replaced by our own static generation.
2026-01-30 16:37:12 +00:00
Wez Furlong 74d95f81a6 docs: refine recent proxy server doc changes
refs: #459
2026-01-19 07:45:10 +00:00
Kevin Vu 8e832ad071 docs: add kumo.start_proxy_listener and changelog entry
Fixes #459
2026-01-19 07:45:09 +00:00
Wez Furlong 07ab3d44a3 inject+xfer: cut over to AuthInfo from AuthKind
Replace the older type with the newer one.

Serialize a copy of auth_info when handling deferred generation,
so that we have a lossless representation of that state when
we eventually process the request.  That doesn't change really
anything today, but will enable more granular ACL checks in
the future.

Pass the auth_info through to the http_message_generated and
xfer_message_received events to enable more granular access
control policies to be scripted.
2025-12-18 10:19:09 +00:00
Wez Furlong 3e85297fca authn: allow returning AuthInfo from smtp/http auth event callbacks
This commit allows the policy to return a richer representation of
the authentication information, which can include multiple identities
and group membership information.
2025-12-18 06:30:06 +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
Wez Furlong b551d6b4c7 docs: update for release 2025.12.02-67ee9e96 2025-12-02 11:11:05 +00:00
Wez Furlong 7b240db3e1 docs: fix copypasta in smtp_server_rewrite_response page
It said smtp_CLIENT instead of server
2025-11-20 14:53:03 +00:00
Wez Furlong 1d70c2ffbb new smtp_server_rewrite_response event
This allows you to customize or otherwise adjust the responses
made by the smtp server.
2025-10-29 08:54:10 +00:00
Wez Furlong 7311510ff6 docs: recip needs to be an array in this example 2025-10-11 07:09:11 +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 f968935315 add smtp_server_split_transaction event
This provides full control over how an incoming smtp transaction
will be split into batches.
2025-10-07 07:53:15 +01:00
Wez Furlong b157e2f617 add smtp_server_data event for per-txn message validation
Great for doing content scanning and recipient list modification!
2025-10-07 07:53:13 +01:00
Wez Furlong 981de67f1c docs: update for 2025.10.06-5ec871ab release 2025-10-07 07:38:10 +01:00
Wez Furlong 6a05a65f73 mpsc: provide shutdown event and clarify single-consumer parts
It was possible to deadlock your policy by triggering queue
length/emptiness checks conurrently with the queue consumer thread.

Let's make it more explicitly clear which methods cannot be used that
way by making their mutex acquisition non-blocking and raise an error.

In addition, let's improve the close method so that it doesn't require
exclusive access to the consumer side of the queue.

Provide a shutdown_logging event that can be used to explicitly close
queues on shutdown, if that is appropriate for your use case.
2025-07-29 15:22:51 +01:00
Mike Hillyer 58e9770206 We miss you Mister Rogers. 2025-07-18 12:11:14 -04:00
Wez Furlong bf76ddd066 docs: fixup get_egress_path_config
You can't actually define this multiple times; I was on early-morning
autopilot when I wrote that up in 48f1e48e6d
2025-05-16 14:07:10 -07:00
Wez Furlong 42bf5c5e61 docs: adjust reference to improve search terms
We've been hoping that mkdocs-material will ship the much anticipated
search enhancements for some time, but it's time to recognize that
we need to do something to improve the search results with how
things work right now.

This is a big commit that changes the titles of the various pages
from the code-annotated synopsis to just the name of the function.

This makes it much easier now to match things like `kumo.reject`
directly, but `reject` remains awkward to find.

I think this is the best that we can do at this time.

A few functions have been annotated with the `status: deprecated` to
show as deprecated in the toc/nav (shows with a little trash can next
to the name).
2025-05-16 14:02:19 -07:00
Wez Furlong 36a14f1ff7 docs: add explicit titles to event reference pages
This makes it easier to search for eg: get_egress_path_config and have
mkdocs return that page as a result.
2025-05-16 06:35:45 -07:00
Wez Furlong 48f1e48e6d docs: expand get_egress_path_config event docs 2025-05-16 06:28:13 -07:00
Wez Furlong c3dff7e2c8 docs: update for latest release 2025-05-06 18:24:15 -07:00
Wez Furlong fedd2959b6 enhance log_arf, log_oob to support LogThenDrop
It is common to want to express that incoming reports should
be logged, but not relayed.

This commit facilitates that by expanding `log_arf` and `log_oob`
to allow more than just a simple boolean value.

We now support both LogThenRelay and LogThenDrop as dispositions
for an incoming report, as well as Ignore to not care about the
report content.

For the LogThenDrop case we'll log only the incoming OOB or Feedback
record to the logs and then discard the incoming message.

For LogThenRelay we'll log the incoming OOB/Feedback report as well
as enqueue the message and log a Reception and, subsequently, records
for its delivery attempts.

The previously supported boolean values are mapped to `Ignore` (false)
and `LogThenRelay` (true), respectively: their behavior is the same as
in prior releases.

The integration test and smtp server tracing infra has been enhanced a
bit to support extracting these new disposition states from the tracer
during the integration test.
2025-05-05 08:25:40 -07:00
Wez Furlong b8310da8be docs: add warning about logging headers
TL;DR: you can easily halve your system performance by logging headers
vs. logging meta.

This is one of those things that is easy to overlook or forget,
but: whenever you need to operate on the message data, rather
than its metadata, the aggregate cost is high.

In this case, we were recently troubleshooting a system where
the CPU was bogged down and we traced it to the logging configuration: a
number of message headers were being logged in a configuration that
made heavy use of throttles and limits in its traffic shaping, and
thus had a large number of Delayed and TransientFailure events being
written to the logs.

When logging headers, each one of those events requires loading
the message from the spool and parsing out the headers.  When the
average message size is ~100KB this imposes a notable overhead
on the CPU and IO utilization of the system.

What we recommend instead of logging headers directly is capturing
the information that you want to log into the message metadata
at the time that the message is received.

The message meta is usually already loaded, but is also typically
much smaller and easier to decode than the full message content
in the cases where it is not loaded.

As a result, it is much cheaper to log meta than to log headers.

This commit adds some warnings and cross links to help folks
be aware of this, and to generally navigate related meta and logging
topics more easily via tags.
2025-04-25 05:52:44 -07:00
Wez Furlong e422f56b5c smtp_server: add smtp_server_get_dynamic_parameters event
This helps to deploy IP-based virtual service.
2025-03-23 08:24:28 -07:00
Wez Furlong 6c49d51ee7 smtp_server: add smtp_server_connection_accepted event 2025-03-23 07:15:45 -07:00
Ryan Bonnell c91b978ea3 Fix misspelling of word 'parameter' 2025-02-28 08:40:07 -08:00
Wez Furlong 01c52eef03 docs: update for 2025.01.23-7273d2bc release 2025-01-23 13:49:35 -07:00
Wez Furlong 49eb0a634c smtp_server_ehlo: pass in and allow returning a list of extensions
This is helpful in situations where you need to do things that
are not strictly supported but might just happen to squeak by
if support is claimed for them.
2025-01-09 11:03:11 -07:00
Wez Furlong 5f19f7ce04 add deferred_queue option to the smtp listener
This option should be used with caution, and ideally only
for trusted networks.

The purpose is to absorb the latency of post-DATA processing
and hide it from the trust injector.

It defers processing that would normally happen in smtp_server_message_received
and instead will, at some (ideally) near-future time trigger an
smtp_server_message_deferred_inject event instead.

This will marginally increase your average injection latency but should
clamp your worst case injection latency much lower because the outliers
will not happen inline with the injecting client.
2024-12-16 11:27:40 -07:00
Wez Furlong cf911c4067 docs: update dev -> 2024.11.08-d383b033 2024-11-12 12:25:53 -07:00
Laurent Marchaud 6142808730 fix a few typos in the docs
Signed-off-by: Laurent Marchaud <laurent@marchaud.com>
2024-10-24 12:10:53 -04:00
Wez Furlong 33d372bdd9 docs: fixup requeue_message get_queue_name method call 2024-10-09 08:19:45 -07:00
Wez Furlong d063c96b5f yell loudly when sig.register() should have been called
A number of our lua event handlers allow registering multiple
implementations to facilitate modular use.

For that to work, we must know ahead of the user lua call running
that any given handle is allowed to register multiple times.  This is so
that we can report a meaningful error when incorrectly using a singleton
handler multiple times, and so that we can record a list of handlers
for the multiple case.

Prior to this commit, if we forgot to arrange to register the signature
as part of the context setup the consequence was that the event handler
would get registered as a singleton and when we went to call it, because
the signature is marked as allowing multiple but was not registered
as multiple, we would skate through and do nothing without reporting
an error because we assumed that the signature was registered
consistently.

In hindsight, that's a terrible idea because it results in silently
ignoring the registration issue, and not calling the event handler
at all.

This commit consolidates the multiple/single value resolution into
the same flow, then adds a check to confirm that we have a list
of handlers registered for the allow_multiple case, raising an
error otherwise that will hopefully encourage users to report
this problem to us if it manifests again in the future.

This commit includes fixing two event handlers that we missing
their signature registration.

One of them was broken anyway by being registered with a name
that didn't match the docs.

refs: https://github.com/KumoCorp/kumomta/issues/236
2024-10-07 10:25:47 -07:00
Wez Furlong 6321557cd0 requeue_message: add smtp_response
This plumbs the smtp response through to the requeue_message event
handler.

While hooking this up, I noticed tha the registered named of the
event was `message_requeued` instead of `requeue_message`. That
name was from the original implementation of the event, and it
just got overlooked when the rest of the references to its
name were updated.

closes: https://github.com/KumoCorp/kumomta/issues/236
2024-10-07 10:08:53 -07:00
Wez Furlong a42871cb11 docs: update since dev -> 2024.09.02-c5476b89 2024-09-02 07:27:50 -07:00
Wez Furlong 75e8a32b59 docs: split start_http_listener into multiple pages 2024-08-18 22:18:59 -07:00
Wez Furlong dbdd69a8c7 docs: split make_egress_source into separate files 2024-08-18 19:47:35 -07:00
Wez Furlong b775816885 docs: split make_egress_path into separate pages 2024-08-18 19:33:31 -07:00
Wez Furlong 1bd2b00b4e docs: move make_listener_domain options to their own pages 2024-08-18 19:19:30 -07:00
Wez Furlong 4af9c7035f docs: move make_queue_config fields to their own pages
This makes them easier to search for, and find.
2024-08-18 19:14:34 -07:00
Tom Mairs 6d4ef9a303 fix typo 2024-07-09 15:09:09 +00:00
Wez Furlong 722f19a078 docs: fix name of requeue_message event in the example 2024-07-08 09:11:34 -07:00
Wez Furlong ef8cbea354 docs: fixup links to the rapidoc http page 2024-06-27 19:56:53 -07:00
Wez Furlong e683fed556 docs: move Log Record to its own reference page
This makes it a bit easier to find and link to.
2024-06-27 08:28:45 -07:00
Wez Furlong a2d76df7a9 NEW: rebind API and kcli subcommand
refs: https://github.com/KumoCorp/kumomta/issues/209
2024-06-24 12:26:06 -07:00
Wez Furlong 8673045fff docs: update for latest release 2024-06-10 09:30:17 -07:00