Skip to content

Rework plugin infrastructure#71

Open
satoqz wants to merge 7 commits intoopenbao:mainfrom
Ki-Reply-GmbH:plugins
Open

Rework plugin infrastructure#71
satoqz wants to merge 7 commits intoopenbao:mainfrom
Ki-Reply-GmbH:plugins

Conversation

@satoqz
Copy link
Member

@satoqz satoqz commented Feb 16, 2026

This PR is based on #69.

Part of openbao/openbao#2459.

@satoqz satoqz force-pushed the plugins branch 8 times, most recently from f34e25c to 4ba475f Compare February 17, 2026 18:58
MagicCookieKey: "HASHICORP_GKW_PLUGIN",
MagicCookieValue: "wrapper",
// ServeOpts configures a KMS plugin server.
type ServeOpts struct {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the TLSProviderFunc intentionally omitted?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC TLSProviderFunc is only needed if the client doesn't support AutoMTLS, which we can assume OpenBao versions using this new plugin type do. While we could add it, not supporting it gives the plugin main functions one less thing to consider.

@satoqz satoqz force-pushed the plugins branch 4 times, most recently from a536c4e to e87fa75 Compare February 18, 2026 11:12
@satoqz satoqz force-pushed the plugins branch 4 times, most recently from ac917de to bca6f5b Compare February 26, 2026 19:59
satoqz added 6 commits March 2, 2026 15:48
Signed-off-by: Jonas Köhnen <[email protected]>
The protobuf setup in this repo is so simple I don't believe dealing
with an additional tool is worth it; protoc is fine.

Additionally, move the protobuf input/output of the plugin package
into a separate package as server/client definitions were polluting the
package namespace.

Signed-off-by: Jonas Köhnen <[email protected]>
Not returning an unimplemented error from these seems more ergonomic,
these are lifecycle hooks that can just default to no-ops without
further complaints.

Signed-off-by: Jonas Köhnen <[email protected]>
@satoqz satoqz changed the title WIP: Revitalize plugin infrastructure Rework plugin infrastructure Mar 2, 2026
@satoqz satoqz marked this pull request as ready for review March 2, 2026 14:48
@satoqz
Copy link
Member Author

satoqz commented Mar 2, 2026

@cipherboy @mrclki okay, the semantics I've come up with here have reached a stable state that has been working well with my upcoming client-side work in the main repo, so opening this one up for review!

For those curious, main repo work is here: https://github.com/Ki-Reply-GmbH/openbao/tree/auto-unseal-plugins. This already works as expected and even supports automatic recovery from plugin crashes. Just missing tests & docs.

if err := initFinalizer.Finalize(
ctx,
); err != nil {
if err := initFinalizer.Init(ctx); err != nil {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We make use of the Options in InitRequest on the client side , but they don't apply here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've omitted passing any options in Init and Finalize because there are no concrete options that any existing Init and Finalize calls accept. I've kept it on the clientside to reduce friction if this ever changes.

Specifically:

  • For SetConfig(), we want to pass WithKeyId and WithConfigMap
  • For Encrypt() and Decrypt(), we want to pass WithAad and WithKeyId
  • For Init and Finalize, it's unclear but part of the interface. We also never pass any options to these in OpenBao.

return &KeyBytesResponse{KeyBytes: keyBytes}, nil

// Call Finalize if the underlying implementation has it.
if initFinalizer, ok := wrapper.(wrapping.InitFinalizer); ok {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as InitRequest, we should make use of req.Options.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Signed-off-by: Jonas Köhnen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants