mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-03 20:17:59 +00:00
command/unseal
This commit is contained in:
55
command/unseal.go
Normal file
55
command/unseal.go
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
package command
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
// UnsealCommand is a Command that unseals the vault.
|
||||||
|
type UnsealCommand struct {
|
||||||
|
Meta
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *UnsealCommand) Run(args []string) int {
|
||||||
|
flags := c.Meta.FlagSet("unseal", FlagSetDefault)
|
||||||
|
flags.Usage = func() { c.Ui.Error(c.Help()) }
|
||||||
|
if err := flags.Parse(args); err != nil {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *UnsealCommand) Synopsis() string {
|
||||||
|
return "Unseals the vault server"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *UnsealCommand) Help() string {
|
||||||
|
helpText := `
|
||||||
|
Usage: vault unseal [options]
|
||||||
|
|
||||||
|
Unseal the vault by entering a portion of the master key. Once all
|
||||||
|
portions are entered, the Vault will be unsealed.
|
||||||
|
|
||||||
|
Every Vault server initially starts as sealed. It cannot perform any
|
||||||
|
operation except unsealing until it is sealed. Secrets cannot be accessed
|
||||||
|
in any way until the vault is unsealed. This command allows you to enter
|
||||||
|
a portion of the master key to unseal the vault.
|
||||||
|
|
||||||
|
General Options:
|
||||||
|
|
||||||
|
-address=TODO The address of the Vault server.
|
||||||
|
|
||||||
|
-ca-cert=path Path to a PEM encoded CA cert file to use to
|
||||||
|
verify the Vault server SSL certificate.
|
||||||
|
|
||||||
|
-ca-path=path Path to a directory of PEM encoded CA cert files
|
||||||
|
to verify the Vault server SSL certificate. If both
|
||||||
|
-ca-cert and -ca-path are specified, -ca-path is used.
|
||||||
|
|
||||||
|
-insecure Do not verify TLS certificate. This is highly
|
||||||
|
not recommended. This is especially not recommended
|
||||||
|
for unsealing a vault.
|
||||||
|
|
||||||
|
`
|
||||||
|
return strings.TrimSpace(helpText)
|
||||||
|
}
|
||||||
10
commands.go
10
commands.go
@@ -36,12 +36,14 @@ func init() {
|
|||||||
"seal": func() (cli.Command, error) {
|
"seal": func() (cli.Command, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
},
|
},
|
||||||
|
|
||||||
"unseal": func() (cli.Command, error) {
|
|
||||||
return nil, nil
|
|
||||||
},
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
"unseal": func() (cli.Command, error) {
|
||||||
|
return &command.UnsealCommand{
|
||||||
|
Meta: meta,
|
||||||
|
}, nil
|
||||||
|
},
|
||||||
|
|
||||||
"version": func() (cli.Command, error) {
|
"version": func() (cli.Command, error) {
|
||||||
ver := Version
|
ver := Version
|
||||||
rel := VersionPrerelease
|
rel := VersionPrerelease
|
||||||
|
|||||||
Reference in New Issue
Block a user