Commit Graph

535 Commits

Author SHA1 Message Date
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 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 Horst 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 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 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 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 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
Wez Furlong 12c4a2f880 docs: change http generated doc disclaimer from note -> info 2026-02-02 10:32:02 +00:00
Wez Furlong ef21bfd427 add msg:increment_num_attempts method 2026-02-02 09:12:35 +00:00
Wez Furlong 14eb3ef52e docs: relative-ize a couple of generated doc links 2026-02-02 08:17:32 +00:00
Wez Furlong b5fb4bd1f9 docs: replace manual http docs with generated docs
we now just have one section containing docs for the HTTP API,
which makes things a bit easier to reason about.
2026-02-02 08:17:20 +00:00
Wez Furlong 90e3c6c1be docs: improve the generated docs for the injection HTTP api 2026-02-02 07:59:38 +00:00
Wez Furlong d0278947ed docs: replace manual metrics docs with auto-generated ones
I factored out the sample outputs and used an include to pull
in that content.

In the future, we could automate creating those sample data files
based on the live instance, however, it will need some thought
as many metrics are instantiated dynamically.  That means that
simply launching the server to dump the initial counters could
miss a large number of the main production counters that are
the most interesting.  Likely we'll need something smarter than
that approach.  But that is an issue for the future!
2026-02-01 08:56:12 +00:00
Wez Furlong 70863b3090 docs: fixup absolute links in generated api docs
Rewrite them to work as relative markdown links so that the
docs are correctly linked in the standalone doc server.
2026-02-01 08:34:25 +00:00
Wez Furlong de9e55aef5 docs: remove some pages in favor of generated versions
A number of manually authored HTTP api docs can now be replaced
by the versions generated from code, making them more accurate
and less likely to drift away from the implementation as
future changes are made, so that's what this commit does.
2026-02-01 08:24:48 +00:00
Wez Furlong cebf0774f4 docs: define json schema tag for linking to kcli docs
Define, by convention, a tag like `kcli:bounce` to indicate that
a jsonschema path definition is linked to the `kcli bounce` subcommand.

This commit adds appropriate tags to each command, and teaches
the jsonschematodocs utility how to generate a boilerplate
paragraph containing the link.
2026-02-01 07:43:10 +00:00
Wez Furlong a8163b6e48 refactor http listener path registration
This commit changes how the various http endpoints are registered;
previously we had to define the handler function in one place,
then in another, explicitly register that handler with a path
and operation type with the router.  If we wanted to also export
documentation about that method, we would need to annotate the handler
with a duplicate of the path and method type.

There was a decent amount of boiler plate and it was very easy to omit
some of that registration information, or for it to potentially drift
or be mistranscribed.

This commit eliminates most of the boiler plate; now we require that
every endpoint be annotated with the utoipa::path macro, which
centralizes the handler, path and method type definition in one place.

To register the route and docs we now have a much simpler
`router_and_docs!` macro that can register both the with the axum router
and with the openapi docs machinery.
2026-02-01 07:30:07 +00:00
Wez Furlong b08179e08e refactor: tidy up jsonschema registration
DRY when it comes to listing out components, request and response
bodies.  We don't need to centrally list those if we're good
at annotating the path macros.

This commit removes a couple of schemas from the docs; that's
ok because the content of those was already inlined into the
respective endpoint docs anyway, so we're not losing anything,
just eliminating a redundant copy of the same information
on a second location.
2026-01-31 07:29:46 +00:00
Wez Furlong ee70f2dbcb docs: fix broken metamethods link 2026-01-30 16:45:12 +00:00
Wez Furlong dfe86f4671 docs: add missing MimeParams section 2026-01-30 16:44:09 +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 255a3c66bc docs: flesh out more of the JSON Schema metadata 2026-01-30 16:23:46 +00:00
Wez Furlong 4bdbf4c58f remove dead code
This `Header` type was unused except for being exported into
the JSON schema, where it was also unreferenced.
2026-01-30 15:53:09 +00:00
Wez Furlong bd4e3f72c8 docs: add jsonschematodocs utility
We currently use a rather hacky embedding of rapidoc to provide a
generic browser around the jsonschema export from our API interface.

It's not great for a couple of reasons:

* The font sizes are tiny
* The documentation rapidoc produces is not indexable, being
  generated by javascript when the browser loads.  This also
  prevents making proper links to the various doc pages

This commit introduces a little utility that we can use during
the doc build to translate the schema into documentation files
that can then be processed as normal by the build.

This commit does this just for kumod at this time, but we could
also add tsa daemon in the future if we expand its API surface.
2026-01-30 15:43:09 +00:00
Wez Furlong c3d48af8f3 jsonschema: refine some metadata
These annotations allow the jsonschema to round-trip through the
utoipa json schema parser, which is important for a follow up
commit that will facilitate improved docs.
2026-01-30 08:13:06 +00:00
Wez Furlong 524fdd87af docs: add tags to kcli commands
This helps link together related things in the docs
2026-01-28 12:49:32 +00:00
Wez Furlong 549e9c611d add per-message xfer functionality
This commit adds a new kumo.xfer module that allows configuring or
cancelling xfer on a per-message basis.
2026-01-28 12:49:06 +00:00
Wez Furlong d0e8e1e9db fix generating multiple To headers with http injection API
Previously, if setting `content.headers["To"]` we'd generate one header
for that value, and one for the per-recipient `To` header value.

We now check to see if the former is present; if so, we'll skip
generating the per-recipient `To` header value.
2026-01-23 12:19:53 +00:00
Wez Furlong baa1775fc2 docs: metrics: note about pruning out metrics
and adjust comment about authorization: now in `main`, it is possible to
change the default ACL if you desire.
2026-01-19 16:13:34 +00:00
Wez Furlong 74d95f81a6 docs: refine recent proxy server doc changes
refs: #459
2026-01-19 07:45:10 +00:00
Wez Furlong 2369162e75 proxy: flip no_splice to use_splice in proxy policy file
This option was named `--no-splice` on the command line because that
was the easiest UX there.  The negative logic makes it harder to
understand how to enable/disable, so let's flip it and default
use_splice=true.

refs: #459
2026-01-19 07:45:09 +00:00
Kevin Vu 8e832ad071 docs: add kumo.start_proxy_listener and changelog entry
Fixes #459
2026-01-19 07:45:09 +00:00
Kevin Vu c3ed6279d5 feat: add TLS and RFC 1929 auth to KumoProxy
Add TLS encryption and username/password authentication support for
the KumoProxy SOCKS5 server, with full Lua configuration capabilities.

Proxy Server Changes:
- Add kumo.start_proxy_listener() Lua function with TLS support
- Add proxy_server_auth_rfc1929 event for Lua-based auth validation
- Return AuthInfo from auth for ACL system integration
- Support optional and required authentication modes
- Maintain backwards-compatible legacy CLI mode (--listen, --timeout-seconds)

Breaking Changes:
- Cache renamed from rfc5321_rustls_config to rustls_client_config

Refs: #451
Closes: 459
2026-01-19 07:45:02 +00:00
Wez Furlong 1d8ce2bb74 http inject: add integration test for request_body_limit
This commit doesn't change any behavior, it just adds an explicit
test for exceeding request_body_limit, and expands on the docs
for request_body_limit to clarify the response when the limit
is exceeded.
2026-01-15 13:52:10 +00:00
Wez Furlong 5b20731ea4 docs: restore proper version for template_dialect
This was accidentally lost in 75debad675
2026-01-07 07:48:20 +00:00