Commit Graph

158 Commits

Author SHA1 Message Date
Wez Furlong 39a046e07c docs: add missing routing_domain param to get_queue_config event examples 2023-10-18 06:56:01 -07:00
Wez Furlong 4c36489681 First pass at accounting db
This keeps track of the volume of receptions and deliveries over time.
2023-10-12 20:43:58 -04:00
Wez Furlong d943a1fc13 logging: add filter_event
This is useful when combining log hooks with local logging, as it
enables you to filter out the log hooks from the local file logs.
2023-09-15 12:10:46 -07:00
Wez Furlong 3cdab67595 logging: add optional segment_header
This is useful for implementing CSV file style logging.
2023-09-15 11:20:10 -07:00
Wez Furlong e7f20cf814 logs: allow using log_record in templates 2023-09-14 14:34:02 -07:00
Wez Furlong 3b10d637f9 docs: show how to use dkim verification
refs: https://github.com/KumoCorp/kumomta/issues/82
2023-09-14 13:03:41 -07:00
Wez Furlong 18223c7799 docs: add note about http_auth 2023-09-12 12:59:40 -07:00
Nathalie Cai 1aca4ae3a8 add dkim canonicalization to dkim helper 2023-09-08 06:51:04 -07:00
Wez Furlong d3b4a191af MTA-STS: expose to path config, implement in smtp_dispatcher
This should be sufficient to enable this feature!

refs: https://github.com/KumoCorp/kumomta/issues/7
2023-08-31 08:54:12 -07:00
Nathalie Cai 6bb9ac387c add mx_list_ip_map to smtp protocole for tls connection (#80)
add mx_list_ip_map to smtp protocole for tls connection

Co-authored-by: Nathalie Cai <ncai@chapsvision.com>
2023-08-30 08:29:18 -07:00
Wez Furlong 5d9d32e7ed Automated doc formatting fix 2023-08-30 00:25:15 +00:00
Wez Furlong 884f8b0171 docs for msg:check_fix_conformance
refs: #17
refs: #24
refs: #26
2023-08-29 17:08:16 -07:00
Wez Furlong 0acef1959a smtp_server: add line_length_hard_limit parameter
refs: https://github.com/KumoCorp/kumomta/issues/25
2023-08-29 06:45:08 -07:00
Wez Furlong 88eca8b838 Add invalid CRLF conformance option to SMTP listener
There's just one option for the whole of the message payload; we don't
distinguish between headers and body for this.

closes: https://github.com/KumoCorp/kumomta/issues/23
closes: https://github.com/KumoCorp/kumomta/issues/22
2023-08-28 18:38:19 -07:00
Wez Furlong 24909f4cde docs: update for 2023.08.22-4d895015 release 2023-08-25 08:38:09 -07:00
Wez Furlong 4d89501564 update trust-dns-resolver to 0.23
With the mail-auth dep removed, we can now update this dep.
2023-08-22 17:40:14 -07:00
Wez Furlong 05e52d4ce6 message: switch ed25519 dkim signing to cfdkim
With the upgraded ed25519-dalek crate, it's now possible to
pass in either DER or PEM encoded PKCS8 signing keys, which
makes it feasible to remove the mail-auth dep from this crate.

That in turns reduces the amount of code in here, which is nice.
2023-08-22 17:27:06 -07:00
Wez Furlong 74f3ebd26e allow configuring DNS resolver parameters 2023-08-22 11:32:23 -07:00
Wez Furlong 71924490d3 message: add set_recipient and set_sender methods 2023-08-15 14:51:35 -07:00
Wez Furlong 55770052a5 add kumo.encode module
This provides a variety of encode/decode functions for things
like base64 and base32 encoding
2023-08-12 08:42:44 -07:00
Wez Furlong d35bffc80d Automated doc formatting fix 2023-08-12 13:55:14 +00:00
Wez Furlong 99fcfbc64e kumod: refresh queue_config periodically
This commit causes the scheduled queue maintainer to refresh
the queue config by calling the get_queue_config event approximately
every minute while the queue is alive.

In addition, we now thread the routing_domain through to get_queue_config
2023-08-12 06:22:54 -07:00
Wez Furlong d8a6bceef0 add kumo.digest lua module
Compute hashes
2023-08-11 21:44:40 -07:00
Wez Furlong e042e81de9 kumo.dns: add lookup_addr function
Resolves a hostname to its v4 and v6 addresses and returns them.

Fixes up a typo in the docs for lookup_mx that incorrectly
showed it as resolve_mx.
2023-08-11 16:51:54 -07:00
Wez Furlong 29ce975970 kcli: add routing_domain support to bounce API and commands 2023-08-10 22:02:07 -07:00
Wez Furlong c9cd17d21f Automated doc formatting fix 2023-08-11 04:35:22 +00:00
Wez Furlong 675736aeb7 docs: add example of SMTP auth affecting relaying 2023-08-10 21:34:02 -07:00
Wez Furlong 7d450fdb41 add kumo.cidr module and kumo.cidr.make_map 2023-08-10 17:21:20 -07:00
Wez Furlong 3fd76dd45a introduce routing_domain concept
Augments our queue name format to be
`campaign:tenant@domain!routing_domain`.

The routing_domain is optional.  If the routing_domain is not set, its
effective value is that of the recipient domain.

You can `msg:set_meta('routing_domain', 'bar.com')` to set the
routing_domain for a message, so if the original recipient was
`user@foo.com`, that would cause the computed queue name for it to be
`foo.com!bar.com`.

The routing_domain is used when deciding on the ready_queue name
and destination MXs, so continuing our example, instead of resolving
`foo.com` MX records we'd resolve `bar.com` and deliver to that site.

The `get_egress_path_config` event `domain` parameter is redefined to be
the effective `routing_domain`.

The `get_queue_config` event `domain` parameter is the regular recipient
domain. The `routing_domain` is not currently made available to
`get_queue_config`. If/when we expose it, it will likely be via a
queue name object instead of adding an additional parameter. That would
be a breaking change.

The consequence of not exposing this parameter is that per-message
routing scenarios for the same domain (but different routing domains)
cannot vary the scheduled queue parmeters (eg: retry intervals). Even
though they would have separate scheduled queue instances, those
instances would have the same scheduled queue parameters.  If you need
to be able to do that, then explicitly setting the domain portion of the
queue name would be a way to do that: `msg:set_meta('queue',
'foo.com-via-bar.com!bar.com')`.  `get_queue_config` would then be
called with `domain='foo.com-via-bar.com'` and your policy could then
respond accordingly.
2023-08-10 08:43:20 -07:00
Wez Furlong bcd2946c53 make_queue_config: now supports protocol.smtp.mx_list for smart hosting
Previously, you would do either:
  `msg:set_meta('queue', 'smart.host.domain')`
or
  `msg:set_meta('queue', '[10.0.0.1]')`

to override the effective domain for a message and cause it to be routed
to somewhere other than the recipient domain.

That was OK for basic smart hosting, but limiting when you wanted to use
multiple candidate hosts.

This commit expands the queue config `protocol` field to support
specifying an explicit list of MX hosts that should be used instead.

The integration tests have been migrated away from the old style to this
new style.

While adding plumbing for this, I uncovered an inconsistency between the
queue name generated for the ready queue and the name used by suspension
handling. The inconsistency was introduced in
0842a0fc8b and related work.  This commit
resolves it.
2023-08-09 23:04:45 -07:00
Mike Hillyer dac5d9f6fa Initial draft of Traffic Shaping Automation documentation. 2023-08-08 14:44:51 -04:00
Wez Furlong 2890138d90 refine handling of suspend=true
and add docs
2023-08-04 11:05:08 -07:00
Wez Furlong b08c865bdb docs: include new tsa related info to the reference section 2023-08-04 11:05:08 -07:00
Cloud User c9a3a7a81c updates to using vault 2023-08-03 19:05:50 +00:00
Wez Furlong 87e0578a33 logging: add nodeid to the log record 2023-07-31 16:57:14 -07:00
M.L. Oelering effa1a6a16 Add doc for remove_all_named_headers 2023-07-06 14:29:59 -07:00
Wez Furlong 0c7978e341 breaking: configure_log_hook: add required name parameter
The name is passed through to should_enqueue_log_record as an additonal
parameter to make it possible to reason about whether a given record
should get queued for a specific log hook instance.

This is a breaking change, but it can be easily resolved by adding
the name parameter to the `configure_log_hook` call.
2023-07-03 08:45:58 -07:00
Wez Furlong 4298698377 docs: some updates for #41 2023-06-30 18:55:39 -07:00
Wez Furlong d3ba5ccd2c connection_limit: implement using leases
To support distributed connection limits, adjust the way that
connection limits are handled.

Previously, we'd do a simple in-memory comparison with the limit to
guide whether we had reached the limit.

In a distributed/clustered scenario we need a shared understanding
of the state of the connections, so we're moving to a lease-based
model.

Each connection is associated with a UUID.
Each egress path maintains a set of connections and their UUIDs.

When attempting to make a new connection, we can only proceed if the
number of connections associated with an egress path is below the limit.

When a connection is closed, its UUID is removed from the associated
set.

To handle crashes, kills and netsplits, the path -> uuid association is
also accompanied by an expiration time beyond which it can be assumed
that the lease is no longer valid.  We compute that time based on the
worst case timeout value for a single message send on the given pathway.
Each time a connection is ready to obtain a new message, it will try
to extend its lease by that same duration.

This commit introduces these concepts and models them using an in-memory
store for the single node case, and using redis for the cluster case.
When your policy enables `kumo.configure_redis_throttles`, that same
redis configuration is used to back to the connection limiting
functionality.

refs: https://github.com/KumoCorp/kumomta/issues/41
2023-06-30 15:39:09 -07:00
Tom Mairs e45c82a3ec update Inject content example 2023-06-30 05:48:24 +00:00
Tom Mairs 2b617a8c65 fix typo 2023-06-30 05:20:35 +00:00
Wez Furlong f65e985e64 docs: add since macro. document connection metadata object 2023-06-28 13:52:15 -07:00
Wez Furlong 5d39928acf add docs for new bounce APIs
and briefly show how to use `kcli` with them
2023-06-22 12:59:36 -07:00
Wez Furlong 6ef093fbc7 docs: explain more about max_ready tradeoffs 2023-06-20 14:33:40 -07:00
Wez Furlong 192c051227 docs: note the default value for max_ready 2023-06-20 14:23:17 -07:00
Wez Furlong 020626360b docs: document enable_tls = 'Disabled' 2023-06-20 08:23:36 -07:00
Wez Furlong d60c961479 increase lua pool limits, allow configuring it 2023-06-16 10:03:49 -07:00
Wez Furlong a2feac004f actually add ehlo_domain to make_egress_source
Enable that field and add it to the fallback used by the
smtp_dispatcher.  The ehlo_domain configured for the pathway
takes precedence, then we'll take the value from the source,
then fallback to the local hostname.

refs: https://github.com/KumoCorp/kumomta/issues/59
2023-06-16 08:43:54 -07:00
Wez Furlong 2992e42138 add received_from and received_via meta values
We don't set received_via for http because axum/hyper make it a
bit weird to access that information and it will require some
effort to figure out how to get that without breaking the
existing proxy-aware client IP determination.
2023-06-13 15:18:06 -07:00
Wez Furlong e8a049cc83 document listener parameter to get_listener_domain update helpers
Allow per-listener listener-domain configuration
2023-05-31 15:46:12 -07:00