Add read:self and cancel:self to sessions; add dev unpriv user (#923)
* Sessions support for read:self and cancel:self permissions. This is automatic with fallback; no API change is needed. * Strips out values from listing if only self actions are allowed on the resource and the user ID is different. This prevents a default ACL of id=*;type=session;actions=read:self,cancel:self from causing all values to be visible when listing. * Adds an unprivileged user to development/testing instances. This user has only default permissions plus the ability to authorize sessions in the default target.
This commit is contained in:
1 parent
d279a906ce
commit
22462cdd84
28 files changed
+626
-196
No files matched your search
@@ -17,6 +17,7 @@ import (
|
||||
"github.com/hashicorp/boundary/internal/servers/worker"
|
||||
"github.com/hashicorp/boundary/internal/target"
|
||||
"github.com/hashicorp/boundary/internal/types/scope"
|
||||
"github.com/hashicorp/boundary/sdk/strutil"
|
||||
"github.com/mitchellh/cli"
|
||||
"github.com/posener/complete"
|
||||
)
|
||||
@@ -43,6 +44,8 @@ type Command struct {
|
||||
flagCombineLogs bool
|
||||
flagLoginName string
|
||||
flagPassword string
|
||||
flagUnprivilegedLoginName string
|
||||
flagUnprivilegedPassword string
|
||||
flagIdSuffix string
|
||||
flagHostAddress string
|
||||
flagTargetDefaultPort int
|
||||
@@ -111,7 +114,7 @@ func (c *Command) Flags() *base.FlagSets {
|
||||
Target: &c.flagPassword,
|
||||
Default: "password",
|
||||
EnvVar: "BOUNDARY_DEV_PASSWORD",
|
||||
Usage: "Initial login password. If set to the empty string, one will be autogenerated.",
|
||||
Usage: "Initial admin login password. If set to the empty string, one will be autogenerated.",
|
||||
})
|
||||
|
||||
f.StringVar(&base.StringVar{
|
||||
@@ -122,6 +125,22 @@ func (c *Command) Flags() *base.FlagSets {
|
||||
Usage: "Initial admin login name. If set to the empty string, one will be autogenerated.",
|
||||
})
|
||||
|
||||
f.StringVar(&base.StringVar{
|
||||
Name: "unprivileged-password",
|
||||
Target: &c.flagUnprivilegedPassword,
|
||||
Default: "password",
|
||||
EnvVar: "BOUNDARY_DEV_UNPRIVILEGED_PASSWORD",
|
||||
Usage: "Initial unprivileged user login password. If set to the empty string, one will be autogenerated.",
|
||||
})
|
||||
|
||||
f.StringVar(&base.StringVar{
|
||||
Name: "unprivileged-login-name",
|
||||
Target: &c.flagUnprivilegedLoginName,
|
||||
Default: "user",
|
||||
EnvVar: "BOUNDARY_DEV_UNPRIVILEGED_LOGIN_NAME",
|
||||
Usage: "Initial unprivileged user name. If set to the empty string, one will be autogenerated.",
|
||||
})
|
||||
|
||||
f.StringVar(&base.StringVar{
|
||||
Name: "api-listen-address",
|
||||
Target: &c.flagControllerAPIListenAddr,
|
||||
@@ -261,6 +280,7 @@ func (c *Command) Run(args []string) int {
|
||||
}
|
||||
c.DevAuthMethodId = fmt.Sprintf("%s_%s", password.AuthMethodPrefix, c.flagIdSuffix)
|
||||
c.DevUserId = fmt.Sprintf("%s_%s", iam.UserPrefix, c.flagIdSuffix)
|
||||
c.DevUnprivilegedUserId = "u_" + strutil.Reverse(strings.TrimPrefix(c.DevUserId, "u_"))
|
||||
c.DevOrgId = fmt.Sprintf("%s_%s", scope.Org.Prefix(), c.flagIdSuffix)
|
||||
c.DevProjectId = fmt.Sprintf("%s_%s", scope.Project.Prefix(), c.flagIdSuffix)
|
||||
c.DevHostCatalogId = fmt.Sprintf("%s_%s", static.HostCatalogPrefix, c.flagIdSuffix)
|
||||
@@ -274,6 +294,12 @@ func (c *Command) Run(args []string) int {
|
||||
if c.flagPassword != "" {
|
||||
c.DevPassword = c.flagPassword
|
||||
}
|
||||
if c.flagUnprivilegedLoginName != "" {
|
||||
c.DevUnprivilegedLoginName = c.flagUnprivilegedLoginName
|
||||
}
|
||||
if c.flagUnprivilegedPassword != "" {
|
||||
c.DevUnprivilegedPassword = c.flagUnprivilegedPassword
|
||||
}
|
||||
c.DevTargetDefaultPort = c.flagTargetDefaultPort
|
||||
host, port, err := net.SplitHostPort(c.flagHostAddress)
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user