* Add ability to specify a plugin dir in dev mode (#3184)
* Change (with backwards compatibility) sha_256 to sha256 for plugin registration
This commit is contained in:
parent
c5918ff79b
commit
c34a5b2e93
|
@ -74,11 +74,12 @@ type ServerCommand struct {
|
||||||
func (c *ServerCommand) Run(args []string) int {
|
func (c *ServerCommand) Run(args []string) int {
|
||||||
var dev, verifyOnly, devHA, devTransactional, devLeasedGeneric, devThreeNode bool
|
var dev, verifyOnly, devHA, devTransactional, devLeasedGeneric, devThreeNode bool
|
||||||
var configPath []string
|
var configPath []string
|
||||||
var logLevel, devRootTokenID, devListenAddress string
|
var logLevel, devRootTokenID, devListenAddress, devPluginDir string
|
||||||
flags := c.Meta.FlagSet("server", meta.FlagSetDefault)
|
flags := c.Meta.FlagSet("server", meta.FlagSetDefault)
|
||||||
flags.BoolVar(&dev, "dev", false, "")
|
flags.BoolVar(&dev, "dev", false, "")
|
||||||
flags.StringVar(&devRootTokenID, "dev-root-token-id", "", "")
|
flags.StringVar(&devRootTokenID, "dev-root-token-id", "", "")
|
||||||
flags.StringVar(&devListenAddress, "dev-listen-address", "", "")
|
flags.StringVar(&devListenAddress, "dev-listen-address", "", "")
|
||||||
|
flags.StringVar(&devPluginDir, "dev-plugin-dir", "", "")
|
||||||
flags.StringVar(&logLevel, "log-level", "info", "")
|
flags.StringVar(&logLevel, "log-level", "info", "")
|
||||||
flags.BoolVar(&verifyOnly, "verify-only", false, "")
|
flags.BoolVar(&verifyOnly, "verify-only", false, "")
|
||||||
flags.BoolVar(&devHA, "dev-ha", false, "")
|
flags.BoolVar(&devHA, "dev-ha", false, "")
|
||||||
|
@ -262,6 +263,10 @@ func (c *ServerCommand) Run(args []string) int {
|
||||||
if devLeasedGeneric {
|
if devLeasedGeneric {
|
||||||
coreConfig.LogicalBackends["generic"] = vault.LeasedPassthroughBackendFactory
|
coreConfig.LogicalBackends["generic"] = vault.LeasedPassthroughBackendFactory
|
||||||
}
|
}
|
||||||
|
if devPluginDir != "" {
|
||||||
|
coreConfig.PluginDirectory = devPluginDir
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if devThreeNode {
|
if devThreeNode {
|
||||||
|
|
|
@ -806,6 +806,10 @@ func NewSystemBackend(core *Core) *SystemBackend {
|
||||||
Type: framework.TypeString,
|
Type: framework.TypeString,
|
||||||
Description: strings.TrimSpace(sysHelp["plugin-catalog_name"][0]),
|
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{
|
"sha_256": &framework.FieldSchema{
|
||||||
Type: framework.TypeString,
|
Type: framework.TypeString,
|
||||||
Description: strings.TrimSpace(sysHelp["plugin-catalog_sha-256"][0]),
|
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
|
return logical.ErrorResponse("missing plugin name"), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
sha256 := d.Get("sha_256").(string)
|
sha256 := d.Get("sha256").(string)
|
||||||
if sha256 == "" {
|
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)
|
command := d.Get("command").(string)
|
||||||
|
|
|
@ -62,7 +62,7 @@ supplied name.
|
||||||
is what is used to look up plugins in the catalog. This is part of the request
|
is what is used to look up plugins in the catalog. This is part of the request
|
||||||
URL.
|
URL.
|
||||||
|
|
||||||
- `sha_256` `(string: <required>)` – This is the SHA256 sum of the plugin's
|
- `sha256` `(string: <required>)` – 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
|
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.
|
they do not match the plugin can not be run.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue