Commit Graph
190 Commits
Author SHA1 Message Date
kay ozakiandWez Furlong 1febfcc55e lua counter series using kumo-counter-series
Co-authored-by: Wez Furlong <wez@wezfurlong.org>
closes: https://github.com/KumoCorp/kumomta/pull/507
2026-05-07 15:35:17 +01:00
Wez Furlong fcb0981c31 deps: update rust-openssl 2026-05-06 22:50:49 +01:00
Wez Furlong b0fa4275f3 cargo update
Note: need to pin hierarchical_hash_wheel_timer back because the latest
version requires a rustc upgrade, and current versions of mlua don't
build against it when the send feature is enabled.
2026-05-06 21:32:01 +01:00
JackandWez Furlong c4dbaa743b proxy-server: add tcp_keepalive option
Some upstream peers (e.g. QQ Mail's rate-limiter) silently hold a
proxied TCP connection open indefinitely — sending no data, FIN, or RST
— rather than cleanly refusing.  Without some kind of timeout
management, the two file descriptors for such a session remain open for
the lifetime of the process, slowly exhausting the kernel's
file-descriptor table and occupying proxy-server worker slots.

This commit configures kernel level keepalive options with reasonable
defaults to detect and close out this class of connection.

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

Closes: https://github.com/KumoCorp/kumomta/pull/509
2026-05-06 21:09:10 +01:00
kay ozakiandWez Furlong f2d98eaf62 psl: normalize domains before psl::domain_str / suffix_str lookups
The `psl` crate's domain_str / suffix_str do byte-exact lookups against
the public-suffix list, so uppercase or trailing-dot inputs (e.g.
"Example.COM" or "example.com." from a DNS Name) silently return None.
Several call sites were passing through user- or DNS-supplied domains
unmodified.

Add a small psl-utils crate that wraps the psl crate:

* normalize_domain(&str) -> Cow<str>: strips a single trailing dot and
  lowercases ASCII; borrows when the input is already normalized so
  the hot path (alignment loop) doesn't allocate.
* domain_str / suffix_str: thin re-exports for callers that have
  already normalized.

psl-utils becomes the only workspace crate that directly depends on
the psl crate; kumo-dmarc and mod-string switch to depending on
psl-utils instead.

Updated call sites:

* kumo-dmarc record.rs: is_relaxed_aligned / is_strict_aligned now
  normalize both inputs first. Replaces the prior eq_ignore_ascii_case
  comparisons.
* kumo-dmarc lib.rs: the organizational-domain fallback in
  DmarcContext::check now normalizes from_domain before calling
  domain_str and compares against the normalized form. Previously a
  mixed-case From: header would skip the _dmarc.<org> lookup entirely.
* mod-string lib.rs: the Lua-exposed string.psl_domain and
  string.psl_suffix bindings normalize their input. Behavior change:
  inputs that previously returned nil due to case or trailing dot now
  resolve.

Co-authored-by: Wez Furlong <wez@wezfurlong.org>
Closes: https://github.com/KumoCorp/kumomta/pull/513
2026-05-06 13:34:15 +00:00
Wez Furlong 07814b08e1 update uuid dep 2026-04-29 08:17:59 +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 35ce0674fb kumo-log-tailer -> kumo-jsonl 2026-04-04 10:45:36 +01:00
Wez Furlong 6318b0c04e Add kumo-log-tailer crate 2026-04-03 19:15:38 +01:00
Wez Furlong 0ed20697a2 deps: update async-nats
This resolves a dependabot issue around the rustls-webpki crate
version that was previously used just by this crate.
2026-04-01 07:34:19 +01:00
Wez Furlong ea786a2585 deps: upgrade testcontainers
This resolves a minor (to us) dependabot alert for a dep that is used
only when we build and run integration tests.
2026-03-31 11:37:14 +01:00
Wez Furlong 787ee3f766 introduce kumo-counter-series crate
This crate implements an in memory ring-buffer based counter series.

It is intended to be used for bounded (and ideally small!) counter time
series.

The idea is that this should be the backing store employed by the
proposed https://github.com/KumoCorp/kumomta/pull/470

closes: https://github.com/KumoCorp/kumomta/pull/475
2026-03-31 11:30:28 +01:00
Wez Furlong 9c2fb0f183 refactor: extract nom_utils to its own crate 2026-03-31 11:16:11 +01:00
Wez Furlong 8a0d6c100e mailparsing: upgrade nom to 8.0 2026-03-28 07:20:28 +00:00
Wez Furlong c8ddb085bb bstr: enable serde support 2026-03-28 07:20:28 +00:00
Wez Furlong 863c323c3a deps: upgrade nom to latest 7.x release 2026-03-28 07:20:27 +00:00
Wez Furlong 1ac2f0ee5b mailparsing: refactor SharedString for binary data
This is a step towards allowing non-UTF-8 data to be tracked
in the SharedString type.

It is not complete; some tests now panic with UTF-8 input where
they would previously implicitly perform a lossy conversion.
That will be resolved in subsequent commit(s).
2026-03-28 07:20:26 +00:00
Wez Furlong 57a7b5e425 update rust-openssl to dane-openssl-v0.10.75 2026-03-05 17:19:52 +00:00
Wez Furlong 3bc3da882b cargo update 2026-02-24 13:03:44 +00:00
Wez Furlong 909b1190cd refactor: extract kumo-api-client from kcli
This enables reusing just the http client parts of kcli
in another module in the future.
2026-02-24 12:19:53 +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 722cd85e82 expose more details to the lua requeue_message event 2026-02-02 15:11:15 +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
Kevin Vu a425ca9f02 refactor: extract kumo-tls-helper crate from rfc5321
Move TLS configuration and async stream traits from rfc5321
into a new shared kumo-tls-helper crate for reuse in
proxy-server and other crates.

Refs #451
2026-01-19 07:13:19 +00:00
Wez Furlong fc2ba2ea27 fixup build after cargo update 2026-01-08 10:42:33 +00:00
Wez Furlong fead711c80 mailparsing: improve charset detection/conformance fixing
We found an interesting issue where a MIME part was labelled as `text/`
with no explicit charset (and was thus implicitly "us-ascii", according
to the specs).  The content was actually UTF-8 encoded farsi text.

Since encoding_rs treats us-ascii as being an alias for windows-1252,
that part was re-encoded as bogus data, rather than being recognized as
UTF-8.

This commit improves the outcome in this situation:

1. Remove encoding_rs.  Replace its Charset type with the Encoding type
   that I added to the charset-normalizer crate in
   https://github.com/nickspring/charset-normalizer-rs/pull/45
   which allows us to actually differentiate between 7-bit ascii
   and latin-1.
2. Improve the handling of body part extraction; there were a couple
   of cases where we didn't consider the charset for text parts(!)
   and now we do, with some additional smarts for when the charset
   fails to decode.
3. Improve the conformance checking.  We do the majority of this
   during parsing, but we don't check for deeper issues such as
   the charset not matching the transfer-decoded payload because
   that is too costly to do for the majoriy of parses.  This commit
   introduces a deep conformance check that does validate that we
   can extract the part, flagging any failures as
   NEEDS_TRANSFER_ENCODING.
4. The charset detection options are threaded through the conformance
   checks and into the logic that extracts the parts during a rebuild,
   so that we can fix up those parts during rebuild.

The bulk of the conformance checking/fixing has been moved into the
mailparsing crate from the message crate, which makes the above a bit
easier and centralizes that logic better--fewer places to look to figure
things out.
2025-12-17 10:31:59 +00:00
Wez Furlong 6119250ebf templates: enable recursive lookup for Handlebars 2025-12-17 06:31:14 +00:00
Aditya GantiandAditya Ganti b96dd0843f Add AWS SigV4 signature module (#457)
* Add AWS SigV4 signature module

 - Implements complete AWS Signature Version 4 algorithm
 - Supports all AWS services (S3, SNS, SQS, Kinesis Firehose, etc.)
 - Includes SHA256 hashing and HMAC-SHA256 signing
 - Secure key management via KeySource (files, Vault, inline)
 - Session token support for temporary credentials
 - Comprehensive documentation and examples
 - 5 unit tests and 5 integration tests (all passing)

 Exposes kumo.aws.sign_v4() function to Lua for signing AWS API
 requests. This enables KumoMTA to integrate with AWS services for
 streaming logs to Kinesis Firehose, storing data in S3, sending
 notifications via SNS, and more.

 Tested with:
 - S3 GET/PUT requests
 - SNS POST requests
 - SQS with query parameters
 - Kinesis Firehose PutRecord

updating README.md file

Co-authored-by: Aditya Ganti <adityaganti@mac.mynetworksettings.com>
2025-11-25 06:14:48 -07:00
Wez Furlong d4028f9931 Add smtp response text normalizer 2025-11-09 08:09:51 +00:00
Wez Furlong 5d78d5b2b5 templates: prepare to support multiple dialects of templates
This is primarily a refactoring of kumo-template to conceptually
support the idea of having multiple dialects, even though it
only defines a single dialect.

It prepares the types/interface for that purpose.

It also pulls in the handlebars crate, but doesn't use anything
from it yet; that'll be in a follow up commit.

refs: https://github.com/KumoCorp/kumomta/issues/446
2025-11-09 07:53:19 +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 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
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
Wez Furlong 32763a98b8 kcli provider-summary: dedup domains in domains list 2025-10-10 18:45:51 +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 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 206dc7c7fa optionally detect legacy 8-bit during check-fix 2025-10-07 07:50:46 +01:00