2023-04-10 15:36:59 +00:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2017-09-19 14:47:10 +00:00
|
|
|
package command
|
|
|
|
|
2018-03-21 21:04:54 +00:00
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
"github.com/mitchellh/cli"
|
|
|
|
)
|
2017-09-19 14:47:10 +00:00
|
|
|
|
|
|
|
type SentinelCommand struct {
|
|
|
|
Meta
|
|
|
|
}
|
|
|
|
|
|
|
|
func (f *SentinelCommand) Help() string {
|
2018-03-21 21:04:54 +00:00
|
|
|
helpText := `
|
|
|
|
Usage: nomad sentinel <subcommand> [options] [args]
|
|
|
|
|
|
|
|
This command groups subcommands for interacting with Sentinel policies.
|
|
|
|
Sentinel policies allow operators to express fine-grained policies as code and
|
|
|
|
have their policies automatically enforced. This allows operators to define a
|
|
|
|
"sandbox" and restrict actions to only those compliant with policy. The
|
|
|
|
Sentinel integration builds on the ACL System. Users can read existing
|
|
|
|
Sentinel policies, create new policies, delete and list existing policies, and
|
|
|
|
more. For a full guide on Sentinel policies see:
|
|
|
|
https://www.nomadproject.io/guides/sentinel-policy.html
|
|
|
|
|
|
|
|
Read an existing policy:
|
|
|
|
|
|
|
|
$ nomad sentinel read <name>
|
|
|
|
|
|
|
|
List existing policies:
|
|
|
|
|
|
|
|
$ nomad sentinel list
|
|
|
|
|
|
|
|
Create a new Sentinel policy:
|
|
|
|
|
|
|
|
$ nomad sentinel apply <name> <path>
|
|
|
|
|
|
|
|
Please see the individual subcommand help for detailed usage information.
|
|
|
|
`
|
|
|
|
|
|
|
|
return strings.TrimSpace(helpText)
|
2017-09-19 14:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (f *SentinelCommand) Synopsis() string {
|
|
|
|
return "Interact with Sentinel policies"
|
|
|
|
}
|
|
|
|
|
2018-04-18 16:02:11 +00:00
|
|
|
func (f *SentinelCommand) Name() string { return "sentinel" }
|
|
|
|
|
2017-09-19 14:47:10 +00:00
|
|
|
func (f *SentinelCommand) Run(args []string) int {
|
|
|
|
return cli.RunResultHelp
|
|
|
|
}
|