diff --git a/command/server.go b/command/server.go index 96bcfcfba..aef950683 100644 --- a/command/server.go +++ b/command/server.go @@ -74,11 +74,12 @@ type ServerCommand struct { func (c *ServerCommand) Run(args []string) int { var dev, verifyOnly, devHA, devTransactional, devLeasedGeneric, devThreeNode bool var configPath []string - var logLevel, devRootTokenID, devListenAddress string + var logLevel, devRootTokenID, devListenAddress, devPluginDir string flags := c.Meta.FlagSet("server", meta.FlagSetDefault) flags.BoolVar(&dev, "dev", false, "") flags.StringVar(&devRootTokenID, "dev-root-token-id", "", "") flags.StringVar(&devListenAddress, "dev-listen-address", "", "") + flags.StringVar(&devPluginDir, "dev-plugin-dir", "", "") flags.StringVar(&logLevel, "log-level", "info", "") flags.BoolVar(&verifyOnly, "verify-only", false, "") flags.BoolVar(&devHA, "dev-ha", false, "") @@ -262,6 +263,10 @@ func (c *ServerCommand) Run(args []string) int { if devLeasedGeneric { coreConfig.LogicalBackends["generic"] = vault.LeasedPassthroughBackendFactory } + if devPluginDir != "" { + coreConfig.PluginDirectory = devPluginDir + } + } if devThreeNode { diff --git a/vault/logical_system.go b/vault/logical_system.go index 2c3e75f22..e8e9331b7 100644 --- a/vault/logical_system.go +++ b/vault/logical_system.go @@ -806,6 +806,10 @@ func NewSystemBackend(core *Core) *SystemBackend { Type: framework.TypeString, Description: strings.TrimSpace(sysHelp["plugin-catalog_name"][0]), }, + "sha256": &framework.FieldSchema{ + Type: framework.TypeString, + Description: strings.TrimSpace(sysHelp["plugin-catalog_sha-256"][0]), + }, "sha_256": &framework.FieldSchema{ Type: framework.TypeString, Description: strings.TrimSpace(sysHelp["plugin-catalog_sha-256"][0]), @@ -939,9 +943,12 @@ func (b *SystemBackend) handlePluginCatalogUpdate(req *logical.Request, d *frame return logical.ErrorResponse("missing plugin name"), nil } - sha256 := d.Get("sha_256").(string) + sha256 := d.Get("sha256").(string) if sha256 == "" { - return logical.ErrorResponse("missing SHA-256 value"), nil + sha256 = d.Get("sha_256").(string) + if sha256 == "" { + return logical.ErrorResponse("missing SHA-256 value"), nil + } } command := d.Get("command").(string) diff --git a/website/source/api/system/plugins-catalog.html.md b/website/source/api/system/plugins-catalog.html.md index b95526194..02c5b6eba 100644 --- a/website/source/api/system/plugins-catalog.html.md +++ b/website/source/api/system/plugins-catalog.html.md @@ -62,7 +62,7 @@ supplied name. is what is used to look up plugins in the catalog. This is part of the request URL. -- `sha_256` `(string: )` – This is the SHA256 sum of the plugin's +- `sha256` `(string: )` – This is the SHA256 sum of the plugin's binary. Before a plugin is run it's SHA will be checked against this value, if they do not match the plugin can not be run.