Commit Graph

19 Commits

Author SHA1 Message Date
Wez Furlong 3a9d0a994f data-loader: improve error message for file read error case 2025-10-24 21:22:14 +01:00
Wez Furlong 47aac10ea6 data-loader: allow callback/event based loading of secrets
This allows a (more or less) arbitrary lua function to be used to load
data.

The primary advantage of this is that the size of the resulting
KeySource struct is smaller than it would be to hold the actual data
inline.  It also enables the surrounding code to be slightly better
factored.
2025-10-24 13:41:27 +01:00
Dario Maiocchi 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
Pankaj Rathi eae61a90fe Add support for custom key names in HashiCorp Vault secrets (#399)
* Add support for custom key names in HashiCorp Vault secrets

Co-authored-by: Wez Furlong <wez@wezfurlong.org>
2025-07-25 06:02:21 +01:00
Wez Furlong 62672a2fbd deps: upgrade mlua to 0.10
This is a reasonably significant upgrade, as it allows for
async functions to be Send, which could unlock more efficiencies
in our overall scheduling.

This commit is just the basic changes required to get the updated
mlua version compiling, it doesn't change anything else.
2024-12-07 09:17:54 -07:00
Dirkjan Ochtman 18db31f204 Manage all external dependencies at the workspace level 2024-11-13 13:50:27 -07:00
Dirkjan Ochtman 6c37410042 Use a workspace dependency for serde 2024-10-15 06:04:53 -07:00
Wez Furlong 64fac57d09 formalize provider information for queues, add to logs
The recent changes to enable shaping based on a pattern-matched provider
are nice, but it is important to be able to observe their effects.

So far this has been awkward because the provider concept was purely a
function of the logic in the shaping.lua file and nothing else.

This commit introduces the concept of a `provider_name` field in
both the EgressPathConfig and QueueConfig structs.

The idea is that the `get_egress_path_config` and `get_queue_config`
events are free to populate this field as makes sense to them, so that
the core is then aware of which provider is associated with those
queues.

Once we have that data, we're then able to log it as a field in the
JsonLogRecord.

That is what this commit does. There are some interesting points to note
about the implementation here:

1. shaping.lua will implicitly assign provider_name if it matches
   any providers.

2. It is technically possible for a shaping.toml to define multiple
   providers that match a given domain. In that circumstance, the
   last matching provider is the winner when it comes to assigning
   the provider_name field.

3. In order to populate the provider_name in the queue.lua helper,
   we need to be able to call out to the get_egress_path_config
   event handlers, so a new kumo.invoke_get_egress_path_config
   has been added to support that.

4. kumo.invoke_get_egress_path_config isn't 100% done: there are
   a couple of fields (openssl related) that don't have a defined
   serializer, so we're simply omitting them.  The function is
   "done enough" for the purposes of retrieving the provider_name

refs: https://github.com/KumoCorp/kumomta/issues/276
2024-09-12 20:51:00 -07:00
Wez Furlong 1184178923 update vaultrs dep 2024-05-23 08:32:54 -07:00
Wez Furlong e6973c2a04 slim down some deps
This helps to remove "false" deps on things like openssl; now that
is linked in only to those components that need it (eg: things that
use unbound for dnssec, or the smtp client for DANE).

This makes the binaries other than kumod (which still has max deps)
a few MB smaller; not a massive win, but nice all the same.
2023-12-22 10:24:30 -07:00
Wez Furlong d843579d1e refactor: control some dep versions via workspace Cargo.toml
This makes it easier to upgrade the version holistically later.
2023-08-17 10:49:25 -07:00
Wez Furlong 5b2cd26d02 data-loader: fix kumo.secrets.load return type
We were returning a lua table holding the returned bytes
instead of a lua byte string.
2023-08-02 12:30:39 -07:00
Wez Furlong e5e8dd11f9 vault: refine integration tests 2023-08-01 16:33:46 -07:00
Wez Furlong f4f1172b56 vault: add to CI so we can run tests 2023-08-01 14:41:28 -07:00
Wez Furlong d33c64b9b0 vault: add integration test and fixup data loading
I think something got screwed up somewhere, because I'm sure this
used to work, but: the value wasn't being parsed out of the loaded
data.

Add an integration test to assert that we can load things.

This test may need some auto-detection to run successfully on CI.
Let's see what happens.
2023-08-01 13:58:50 -07:00
Wez Furlong 0c70ab2c52 improve error message when converting lua -> rust types
refs: https://github.com/KumoCorp/kumomta/issues/56
2023-06-14 20:14:14 -07:00
Wez Furlong 992cae1409 Allow loading a key source directly from lua
This makes it easier to compose secret management with a variety
of lua functions without having to build that directly into each
of them.

In particular: one can now use vaults or other secret stores that
we add in the future to manage credentials for HTTP clients.
2023-05-09 08:25:54 -07:00
Wez Furlong cf1ba5f0b2 add key_data source for key data, refactor docs
Break out the KeySource object into its own reference page to
avoid manually duplicating the same information into multiple pages.

Explain how to use data fetched from eg: sqlite.
2023-03-23 08:27:14 -07:00
Wez Furlong c184214253 allow loading TLS key+cert from hashicorp vault
refactor to allow reusing the same key loader logic for dkim, smtp
and http.
2023-03-04 11:01:35 -07:00