diff options
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/hakurei/command.go | 6 | ||||
| -rw-r--r-- | cmd/hakurei/command_test.go | 4 | ||||
| -rw-r--r-- | cmd/hsu/main.go | 7 |
3 files changed, 11 insertions, 6 deletions
diff --git a/cmd/hakurei/command.go b/cmd/hakurei/command.go index 0c3e5e7a..d284e075 100644 --- a/cmd/hakurei/command.go +++ b/cmd/hakurei/command.go @@ -45,7 +45,7 @@ func buildCommand(ctx context.Context, msg container.Msg, early *earlyHardeningE c.Command("shim", command.UsageInternal, func([]string) error { app.ShimMain(); return errSuccess }) - c.Command("app", "Load app from configuration file", func(args []string) error { + c.Command("app", "Load and start container from configuration file", func(args []string) error { if len(args) < 1 { log.Fatal("app requires at least 1 argument") } @@ -74,14 +74,14 @@ func buildCommand(ctx context.Context, msg container.Msg, early *earlyHardeningE flagWayland, flagX11, flagDBus, flagPulse bool ) - c.NewCommand("run", "Configure and start a permissive default sandbox", func(args []string) error { + c.NewCommand("run", "Configure and start a permissive container", func(args []string) error { // initialise config from flags config := &hst.Config{ ID: flagID, Args: args, } - if flagIdentity < 0 || flagIdentity > 9999 { + if flagIdentity < hst.IdentityMin || flagIdentity > hst.IdentityMax { log.Fatalf("identity %d out of range", flagIdentity) } diff --git a/cmd/hakurei/command_test.go b/cmd/hakurei/command_test.go index dd16b250..d22249f3 100644 --- a/cmd/hakurei/command_test.go +++ b/cmd/hakurei/command_test.go @@ -21,8 +21,8 @@ func TestHelp(t *testing.T) { Usage: hakurei [-h | --help] [-v] [--json] COMMAND [OPTIONS] Commands: - app Load app from configuration file - run Configure and start a permissive default sandbox + app Load and start container from configuration file + run Configure and start a permissive container show Show live or local app configuration ps List active instances version Display version information diff --git a/cmd/hsu/main.go b/cmd/hsu/main.go index cb82c204..1f6ca7b6 100644 --- a/cmd/hsu/main.go +++ b/cmd/hsu/main.go @@ -1,5 +1,7 @@ package main +// minimise imports to avoid inadvertently calling init or global variable functions + import ( "bytes" "fmt" @@ -19,6 +21,9 @@ const ( envGroups = "HAKUREI_GROUPS" PR_SET_NO_NEW_PRIVS = 0x26 + + identityMin = 0 + identityMax = 9999 ) func main() { @@ -91,7 +96,7 @@ func main() { // allowed identity range 0 to 9999 if as, ok := os.LookupEnv(envIdentity); !ok { log.Fatal("HAKUREI_IDENTITY not set") - } else if identity, err := parseUint32Fast(as); err != nil || identity < 0 || identity > 9999 { + } else if identity, err := parseUint32Fast(as); err != nil || identity < identityMin || identity > identityMax { log.Fatal("invalid identity") } else { uid += identity |
