Task 2.4: Choose a Vault policy based on requirements
Writing the smallest policy that meets a requirement: which paths, which capabilities, how several policies combine, and where deny or a parameter rule is needed.
Study it
Choosing a policy: the smallest set of paths and capabilities, and explicit deny
Try each one before opening the answer. Every option is explained, with the HashiCorp documentation page that proves it.
Question 1 · choose 1
Team web uses the KV v2 mount secret/. Its members must be able to read, write, list and soft-delete secrets under web/, but must never be able to remove version data permanently. Which policy fits?
Asecret/data/web/*: create, read, update, delete; and secret/metadata/web/*: list
Bsecret/web/*: create, read, update, delete, list
Csecret/data/web/*: create, read, update, delete; and secret/metadata/web/*: list, delete
Dsecret/data/web/*: create, read, update, patch; and secret/metadata/web/*: list, read
Show the answer and why
Asecret/data/web/*: create, read, update, delete; and secret/metadata/web/*: list
Correct
On KV v2, delete on data/ is a soft delete of the latest version, and list on metadata/ lists keys; nothing here can purge data.
Bsecret/web/*: create, read, update, delete, list
Incorrect
KV v2 serves data under data/ and metadata/, so a policy on secret/web/* matches none of the API paths.
Csecret/data/web/*: create, read, update, delete; and secret/metadata/web/*: list, delete
Incorrect
delete on metadata/ permanently removes the key's metadata and every version.
Dsecret/data/web/*: create, read, update, patch; and secret/metadata/web/*: list, read
Incorrect
Without delete on data/, members cannot soft-delete the latest version, which the requirement needs.
KV v2 splits a secret across data/, metadata/, delete/, undelete/ and destroy/ paths, so a policy chooses capabilities per prefix. Soft deletes stay recoverable; metadata deletes and destroy calls do not.
Users on the userpass method must be able to change passwords, but must not be able to change any other setting of a user, such as token_ttl. Which rule on the userpass users path fits?
SecretIDs for the AppRole my-role must always be returned wrapped, with a wrapping TTL of at most 90 seconds. Which rule on auth/approle/role/my-role/secret-id enforces this?
Amax_wrapping_ttl = "90s" alone with create and update
Bttl = "90s" with create and update, the policy setting for wrapped responses
Callowed_parameters = { "wrap_ttl" = ["90s"] } with create and update
Dmin_wrapping_ttl = "1s" and max_wrapping_ttl = "90s" with create and update
Show the answer and why
Amax_wrapping_ttl = "90s" alone with create and update
Incorrect
A maximum alone does not force clients to request wrapping.
Bttl = "90s" with create and update, the policy setting for wrapped responses
Incorrect
Policies have no ttl setting; wrapping limits use the wrapping TTL parameters.
Callowed_parameters = { "wrap_ttl" = ["90s"] } with create and update
Incorrect
Wrapping is requested with a header or CLI flag, not a body parameter that this rule could check.
Dmin_wrapping_ttl = "1s" and max_wrapping_ttl = "90s" with create and update
Correct
A minimum wrapping TTL of one second makes wrapping mandatory, and the maximum caps the TTL clients request.
Policies can require and bound response wrapping per path, which keeps sensitive values such as SecretIDs out of plain responses.
A delegated team may create and update token roles, but no role may list admin in allowed_policies; any other policy name is fine. Which rule on auth/token/roles/* fits?
Acreate and update with denied_parameters = { "allowed_policies" = [] }
Bcreate and update with allowed_parameters = { "allowed_policies" = ["admin"] }
Ccreate and update with denied_parameters = { "allowed_policies" = ["admin"] }
Dcreate, update and deny on auth/token/roles/admin
Show the answer and why
Acreate and update with denied_parameters = { "allowed_policies" = [] }
Incorrect
An empty list denies any change to that parameter, not just admin.
Bcreate and update with allowed_parameters = { "allowed_policies" = ["admin"] }
Incorrect
This would allow only admin and block every other parameter.
Ccreate and update with denied_parameters = { "allowed_policies" = ["admin"] }
Correct
A populated denied list blocks requests containing those values and leaves all others allowed.
Dcreate, update and deny on auth/token/roles/admin
Incorrect
That denies a role named admin; it does not stop other roles from allowing the admin policy.
Empty lists allow or deny any value; populated lists allow or deny only the listed values.