Declarative plugins
External plugins can be declared with the plugin stanza.
This is primarily intended for:
- Simple plugin deployment: The combination of OCI-based plugin distribution, auto-download, and auto-registration is the recommended plugin deployment flow.
kmsplugin deployment:kmsplugins cannot be registered via the API (since they must be available in a sealed state). The declarative method is the only way to definekmsplugins.
The plugin stanza allows the declaration of both plugins automatically
downloaded from an OCI registry and manually downloaded plugins.
OCI-based plugin distribution
OpenBao supports the distribution of plugins in Open Container Initiative (OCI) artifacts. Operators can define the desired plugins for their OpenBao cluster directly in the server configuration files. On startup, OpenBao will check for locally cached binaries, verify their integrity, and only download and extract new or updated plugin binaries from the specified OCI artifacts if necessary. This approach uses existing container ecosystem tooling and infrastructure for robust, secure, and efficient plugin management.
Making use of OCI based plugins provides a number of advantages over manually managing the plugin binaries:
- Automated Discovery and Installation: Operators can define the used plugins in code and OpenBao will automatically download and extract them during startup.
- Version Management: Distributing new a new version of a plugin just requires an update of the configuration file instead of manually placing the binary on every node.
- Supply Chain Security: Using OCI registries for plugin distribution allows operators to make use of the registries security features like authentication, vulnerability scanning and immutable storage.
plugin
A plugin block defines an OCI-based plugin to download:
plugin "type" "name" {
image = "registry.example.com/org/plugin"
version = "v0.0.0"
sha256sum = "sha256-checksum"
}
Or it specifies a plugin to automatically register that was manually downloaded:
plugin_auto_register = true
plugin "type" "name" {
command = "plugin-binary-name"
version = "v0.0.0"
sha256sum = "sha256-checksum"
env = ["MY_ENV=value"]
args = ["-some-argument"]
}
Multiple plugin blocks may exist and OCI plugins are downloaded in the order they
are specified in the configuration file(s). Blocks may share the same type and
name but must have different a version. This allows for seamless upgrades of
plugin versions.
type must be one of the pre-defined plugin types available in OpenBao, see
plugin system for more information.
Parameters
-
image(string: required)- OCI artifact/image URL including registry and repository. Conflicts with thecommandvalue. One ofimageorcommandis required. -
command(string: required)- Command name of the plugin that has been manually downloaded. Conflicts with theimagevalue. One ofimageorcommandis required. -
version(string: required)- The image version or tag. -
sha256sum(string: required)- Expected SHA-256 digest of the plugin binary. Must be a 64-character hexadecimal string. -
args([]string: optional)- Any arguments to pass to the running plugin. Only used ifplugin_auto_register=trueis set at the global level. -
env([]string: optional)- Any environment variables to pass to the running plugin. Only used ifplugin_auto_register=trueis set at the global level. -
binary_name(string: optional)- Name of the plugin binary file within the OCI image. Only applies whenimageis set. If unset, OpenBao determines the binary name by reading the OCI image'sENTRYPOINTandCMDmetadata (in that order). Plugin images distributed via openbao-plugins always setENTRYPOINT, so you don't need to set this option.
Example
- JSON
- HCL
{
"plugin": [
{
"secret": {
"aws": {
"image": "ghcr.io/openbao/openbao-plugin-secrets-aws",
"version": "v1.0.0",
"sha256sum": "9fdd8be7947e4a4caf7cce4f0e02695081b6c85178aa912df5d37be97363144c"
}
}
}
]
}
plugin "secret" "aws" {
image = "ghcr.io/openbao/openbao-plugin-secrets-aws"
version = "v1.0.0"
sha256sum = "9fdd8be7947e4a4caf7cce4f0e02695081b6c85178aa912df5d37be97363144c"
}
plugin_download_behavior
A string which controls server behavior when plugin downloads fail.
plugin_download_behavior = "fail"
Values
"fail"(default)- Server startup fails if any plugin download fails"warn"- Log warnings for failed downloads but continue startup
plugin_auto_download
A boolean which controls server behavior of whether or not plugins are automatically downloaded on server startup and SIGHUP.
plugin_auto_download = true
Values
true- server startup andSIGHUPtriggers downloading of plugins; can still be manually downloaded withbao plugin init.false- onlybao plugin initwill manually download plugins.
plugin_auto_register
A boolean which controls server behavior of whether or not plugins are automatically registered on server startup and SIGHUP.
plugin_auto_register = true
Values
true- server startup andSIGHUPtriggers registering of plugins; can still be manually registered withbao plugin register.false- onlybao plugin registerwill manually register plugins.
plugin_download_max_size
A number defining the maximum allowed plugin binary size in bytes when extracted from an OCI image. Defaults to 536870912 (512 MiB) if not set.
Authentication
When downloading plugin images from a private registry, OpenBao will use credentials as described in the Docker or Podman configuration files present on the system in the following order:
~/.docker/config.jsonor%USERPROFILE%\.docker\config.jsonon Windows.- A
config.jsonfile in the directory specified in theDOCKER_CONFIGenvironment variable. - The path specified by the
REGISTRY_AUTH_FILEenvironment variable. $XDG_RUNTIME_DIR/containers/auth.json
When deploying OpenBao to Kubernetes you can mount an Image Pull Secret into the Pods to use for authentication.
Complete example
storage "raft" {
path = "/opt/openbao/data"
}
listener "tcp" {
address = "0.0.0.0:8200"
}
plugin_directory = "/opt/openbao/plugins"
plugin_download_behavior = "fail"
plugin "secret" "aws" {
image = "ghcr.io/openbao/openbao-plugin-secrets-aws"
version = "v1.0.0"
sha256sum = "9fdd8be7947e4a4caf7cce4f0e02695081b6c85178aa912df5d37be97363144c"
}
OCI image requirements
OpenBao requires the plugin binary to be present in the image's root directory. It is also advised to make use of a static Go binary to not run into any libc issues.
Example Containerfile
FROM scratch
LABEL org.opencontainers.image.source=https://github.com/openbao/openbao-plugins
COPY bin/openbao-plugin-auth-aws_linux_amd64* openbao-plugin-auth-aws
ENTRYPOINT ["/openbao-plugin-auth-aws"]
Set either ENTRYPOINT or CMD such that binary_name does not need to be
configured explicitly when installing the plugin.