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.
Two issues:
* A kumo.reject(421,...) wasn't guaranteed to terminate the session,
so make it do that.
* A non-421 kumo.reject would prevent the current candidate message from
being queued, but could result in a spurious additional 250 ok
response.
Refactor the data phase processing so that we first make a pass
over the messages to allow allow of them to be assessed by the
event before we commit to logging and injecting any of them.
Since the spool system is not (and cannot be made to be)
transactional across multiple messages, there is still a possibility
that a failure to spool at this stage will result in the
previously accepted messages from that batch being accepted,
event though we will then respond to the client with a failure
code.
closes: https://github.com/KumoCorp/kumomta/issues/79
The mail must flow!
However, it is unspecified which shaping rules we'll actually use in
that situation; the current effective order of resolution and behavior
must not be relied upon and may change without notice or anyone even
realizing that it changed.
Previously, we'd let these get rolled into the "something went wrong
with this host, let's try the next" bucket.
Now we directly consider them to be transient failures, log them
and requeue them.
Seems like everyone on the internet is finding that GH actions
disk space is a bit tight. Let's adopt this action that is
intended to delete some things that are not often used and
see if that helps our builds
Event handlers must be registered at the file scope and not from
within another event handler in order for events to be consistently
triggered and handled.
In particular, the `init` event is only ever triggered once on
server startup. If other handlers are registered from within the
init event, those will only ever fire when we re-use that original
lua context, which is good for a limited number of uses before it
is aged out of the resource pool. That might work under very
limited or lightweight testing scenarios, but will otherwise
result in very inconsistent behavior.
We now catch and prevent, with a very visible error, attempting
to call `kumo.on` from within an event handler.
Previously, it would result in:
"KumoMTA internal: failed to connect to any candidate hosts: invalid DNS name: invalid dns name: invalid dns name, invalid DNS name: invalid dns name: invalid dns name"
which is not at all instructive.
Now it should report something like:
"KumoMTA internal: failed to connect to any candidate hosts: STARTTLS: 10.0.0.1 is not a valid DNS name"