Manage access to Vault with joint controller authorization
Enterprise only
Control groups require a Vault Enterprise Plus license or HCP Vault Dedicated plus tier cluster.
Control groups add additional authorization factors to be required before processing requests to increase the governance, accountability, and security of your secrets. When a control group is required for a request, the requesting client receives the wrapping token in return. Only when all authorizations are satisfied, the wrapping token can be used to unwrap the requested secrets.
Challenge
In order to operate in EU, a company must abide by the General Data Protection Regulation (GDPR) as of May 2018. The regulation enforces two or more controllers jointly determine the purposes and means of processing (Chapter 4: Controller and Processor).
Consider the following scenarios:
Anytime an authorized user requests to read data at "
EU_GDPR_data/data/orders/*
", at least two people from the Security group must approve to ensure that the user has a valid business reason for requesting the data.Anytime a database configuration is updated, it requires that one person from the DBA and one person from Security group must approve it.
Solution
Use Control groups in your policies to implement dual controller authorization required.
Prerequisites
To perform the tasks described in this tutorial, you need to have the following:
- A Vault Enterprise environment or an HCP Vault Dedicated plus tier cluster.
- jq installed to process the JSON output for readability.
This tutorial assumes that you have some hands-on experience with ACL policies as well as Identities. If you are not familiar, go through the following guides first:
Policy requirements
Since this tutorial demonstrates the creation of policies, log in with a highly
privileged token such as root
. Otherwise, required permissions to perform the
steps in this tutorial are listed below.
Scenario introduction
The scenario in this tutorial is that a user, Bob Smith
has
read-only permission on the "EU_GDPR_data/data/orders/*
" path; however,
someone in the acct_manager
group must approve it before he can actually
read the data.
As a member of the acct_manager
group, Ellen Wright
can authorize
Bob's request.
Personas:
- admin with privileged permissions to create policies and identities
- processor with limited permission to access secrets
- controller with permission to approve secret access
Scenario workflow
You are going to perform the following:
- Lab setup
- Implement a control group
- Deploy the policies
- Setup entities and a group
- Test the control group
If you want to implement control groups in Sentinel, read the ACL Policies vs. Sentinel Policies section.
Lab setup
Download the latest version of the Vault Enterprise binary.
Extract the Vault binary where x.x.x is the actual version number.
Open a terminal and export an environment variable for the Vault Enterprise license generated by the sign up process.
From the directory you extracted the Vault Enterprise binary, start a Vault dev server with
root
as the root token.The Vault dev server defaults to running at
127.0.0.1:8200
. The server is also initialized and unsealed.Insecure operation
Do not run a Vault dev server in production. This approach is only used here to simplify the unsealing process for this demonstration.
Open a new terminal and export an environment variable with the Vault server address.
Export an environment variable with the Vault token.
Verify the Vault server started successfully with the trial license.
The Vault server is ready.
Implement a control group
(Persona: admin)
Create a policy file named
read-gdpr-order.hcl
.Examine the policy
The condition is that Bob can
read
the secrets atEU_GDPR_data/data/orders/*
if someone from theacct_manager
group approves.read-gdpr-order.hcl1 2 3 4 5 6 7 8 9 101112
For the purpose of this tutorial, the number of
approvals
is set to1
to keep it simple and easy to test. Any member of the identity group,acct_manager
can approve the read request. Although this example has only one factor (authorizer
), you can add as many factor blocks as you need.Create another policy file named,
acct_manager.hcl
. This is the policy needed for the member of controller (acct_manager
) to approve Bob's request.The important thing here is that the authorizer must have
create
andupdate
permission on thesys/control-group/authorize
endpoint so that they can approve the request.
Deploy the policies
(Persona: admin)
Deploy the read-gdpr-order
and acct_manager
policies that you wrote.
Create a new policy named
read-gdpr-order
.Create a new policy named
acct_manager
.
Setup entities and a group
(Persona: admin)
This step only demonstrates CLI commands and Web UI to create entities and groups. Refer to the Identity - Entities and Groups tutorial if you need the full details.
Now that you have policies created, create a user bob
, and an acct_manager
group with
ellen
as a group member.
Note
For the purpose of this tutorial, use the userpass
auth method to
create user bob
and ellen
so that the scenario can be easily tested.
Enable the
userpass
auth method.Create a new user,
bob
with password, "training".Create a new user,
ellen
with password, "training".Retrieve the userpass mount accessor and save it in a file named
accessor.txt
.Create
Bob Smith
entity and save the identity ID in theentity_id_bob.txt
.Add an entity alias for the
Bob Smith
entity.Example output:
Create
Ellen Wright
entity and save the identity ID in theentity_id_ellen.txt
.Add an entity alias for the
Ellen Wright
entity.Example output:
Create
acct_manager
group and addEllen Wright
entity as a member.Example output:
Test the control group
(Persona: admin)
Validate the control groups work by request a secret as Bob and approving the request as Ellen.
Enable the key/value secrets engine at
EU_GDPR_data
.Write some mock data.
Example output:
(Persona: processor)
Unset the
root
Vault token.Log in as
bob
.Request to read "
EU_GDPR_data/orders/acct1
".Example output:
The response includes
wrapping_token
andwrapping_accessor
. Export their values as environment variables for use in later steps.Note
Be sure to replace the example
wrapping_token
andwrapping_accessor
values with your actual values.Export the wrapping token value as
WRAPPING_TOKEN
.Export the wrapping token accessor as
WRAPPING_ACCESSOR
.Example:
(Persona: controller)
A user who is a member of the acct_manager
group can check
and authorize Bob's request using the request
and authorize
commands.
Log in as
ellen
who is a member ofacct_manager
group.Check the current status.
The
approved
status is currentlyfalse
since it has not been approved.Approve the request.
Now, the
approved
status istrue
.
(Persona: processor)
Since the control group requires one approval from a member of acct_manager
group, the condition has been met. Log back in as bob
and unwrap the secret.
Log back in as bob using the userpass auth method.
Unwrap the secrets by passing the
$WRAPPING_TOKEN
environment variable.
Define a control group for operations
Assume that Bob's token has read-paris
and change-paris
policies attached.
The read-paris
allows Bob to perform read and list operations against the
paris-kv/*
path.
The change-paris
policy requires 1 approval from eng-managers
group if Bob
tries to perform create, update or delete operation against the paris-kv/*
path.
The intention was that Bob can read or list secrets at paris-kv/*
without
authorization. However, when both of those policies are applied, even the read
and list operations will trigger the control groups. The read and list
capabilities from the read-paris
policy get aggregated into the change-paris
capabilities list.
Controlled capabilities
To solve this, use controlled_capabilities
in the policy to narrow the scope of control group to the operation level.
Test controlled capabilities
Login with the admin persona's token.
Note
For Vault Enterprise, use
root
as the token value. For HCP Vault Dedicated, use the admin token from the HCP Portal.Create a
restrict-paris
policy.Deploy the
restrict-paris
policy.Add the policy to Bob's entity.
Example output:
Enable
kv-v2
secrets engine atparis-kv
.Create some mock data at
paris-kv
.Log in as
bob
.The returned token should have
restrict-paris
policy attached.Example output:
Read the secrets at
paris-kv/product
.You should be able to read the secrets without triggering the control group.
Try to delete the secrets at
paris-kv/product
.This time, Vault returns
wrapping_token
andwrapping_accessor
.Example output:
Optional: If you want to complete the rest of the workflow, repeat the steps you performed previously in the Test the control group section.
- Login as
ellen
. - Authorize Bob's request using the wrapping accessor value.
- Login as
bob
. - Unwrap the secrets using the wrapping token.
ACL policy vs. Sentinel policy
Although the read-gdpr-order.hcl
was written as ACL policy, you
can implement control groups in either ACL or Sentinel policies.
Using Sentinel, the same policy may look something like.
1 2 3 4 5 6 7 8 9 101112131415161718
Deploy this policy as an Endpoint Governing Policy attached to
"EU_GDPR_data/data/orders/*
" path.
Tip
Refer to the Sentinel Properties documentation for the list of available properties associated with control groups. If you are new to Sentinel, go through the Sentinel Policies tutorial.