Step 6 - Provide Users Access to Secrets
This procedure steps through creating user groups and policies with the CLI. User Groups and policies can also be created, viewed, and managed in the DSV User Interface.
-
With two secrets, each located at:
servers:us-east:server01 and servers:us-east:production:server01
-
And two users:
developer1@company.com and developer2@company.com
You can create a policy to allow:
- both users access to servers:us-east:server01
- developer1@company.com to have access to servers:us-east:production:server01
- developer2@company.com to be denied access to servers:us-east:production:server01
Creating a User Group
Optionally, we can put these Users in a Group with two commands.
-
The first command creates the group:
Copydsv group create --group-name firstgroup -
The second command puts the Users in the Group
Copydsv group add-members --group-name firstgroup --data '{"memberNames":["developer1@company.com","developer2@company.com"]}'
Creating a Policy to Allow Access
The admin has to create a policy for the Group to get access to the Secrets. Here is a sample CLI command:
dsv policy create --path secrets:servers:us-east --actions '<.*>' --desc 'Allow Policy' --subjects groups:firstgroup --effect allow
-
pathstarts withsecrets: followed by the secret path.resourcesis not specified separately, but will default to the path and everything below it, so in this casesecrets:servers:us-east:<.*> -
actionsis a wildcard, so fullcreate, read, update, deleteare allowed. -
subjectsare the Users that are getting access to the secrets. -
effectwill either allow or deny access. -
Use the command
dsv policy read secrets:servers:us-east -e yamlto read the resulting policy:Copypath: secrets:servers:us-east
permissionDocument: - actions: - <.*> conditions: {} description: Allow Policy effect: allow id: xxxxxxxxxxxxxxxxxxxx meta: null resources: - secrets:servers:us-east:<.*> subjects: - groups:firstgroup version: "0" -
This policy will now enable both Users (developer1@company.com and developer2@company.com) to gain full access to all secrets located at the path
servers:us-eastand below.
Creating a Policy to Deny Access
If we decide that the developer2@company.com should no longer have access to the secrets at servers:us-east:production, we can write another policy to deny access. The command would look like this:
dsv policy create --path secrets:servers:us-east:production --actions '<.*>' --desc 'Deny Policy' --subjects 'users:<developer2@company.com>' --effect deny
Use the command dsv policy read secrets:servers:us-east:production -e yaml to view the resulting policy:
path: secrets:servers:us-east:production
permissionDocument:
- actions:
- <.*>
conditions: {}
description: Deny Policy
effect: deny
id: xxxxxxxxxxxxxxxxxxxx
meta: null
resources:
- secrets:servers:us-east:production:<.*>
subjects:
- users:<developer2@company.com>
version: "0"
Now developer1@company.com has access to everything at servers:us-east and below, including servers:us-east:production. However, developer2@company.com only has access to the secrets at servers:us-east and not at servers:us-east:production
This is the end of the quick-start guide, but for more on policies see CLI Reference in this documentation.