Hi Dave,
> 1. Creating a token role
> The documentation states "Role parameters, when set, override any provided
> options to the create endpoints." I first set only the "period" parameter,
> then attempted to create a token using the root role. This failed with the
> error "Token policies must be a subset of the role's allowed policies".
> Given that the root role was used, that was an unexpected error. I found
> that I had to also add the token's desired policies to the role parameter
> "allowed_policies" to avoid this error. Is that the expected behavior?
Yes. As the documentation notes, the parameters override any provided
options. This includes the policies of the calling token, regardless
of whether it is root. Generally speaking, root only allows bypassing
the path-based ACLs, but has no bearing on parameters given to paths.
> 2. Revoking a token created using token role
> Let's assume the token role is named "devrole" and the token is "devtoken".
> Revoking such a token by the usual means (POST /auth/token/revoke/devtoken)
> did not work. I then tried using the revoke-prefix method like this: POST
> /auth/token/revoke-prefix/devrole. That too failed. What did work was this:
> POST /auth/token/revoke-prefix/auth/token/create/devrole. Is this the only
> way to revoke such a token?
I can't really answer this without more information, especially, what
error messages you were seeing and the role parameters you used. I
can't reproduce this though:
$ vault write auth/token/roles/testrole period=3600
allowed_policies="foo,bar" orphan=true
Success! Data written to: auth/token/roles/testrole
$ vault write -f auth/token/create/testrole
token
09281a31-ca0f-ad1d-ed6d-7a9d39127bc0
...
$ vault token-lookup 09281a31-ca0f-ad1d-ed6d-7a9d39127bc0
accessor c220c740-a325-c38c-0d65-6d5162869b83
...
$ vault write -f auth/token/revoke/09281a31-ca0f-ad1d-ed6d-7a9d39127bc0
Success! Data written to: auth/token/revoke/09281a31-ca0f-ad1d-ed6d-7a9d39127bc0
$ vault token-lookup 09281a31-ca0f-ad1d-ed6d-7a9d39127bc0
error looking up token: Error making API request.
...
* bad token
> 3. Unexpected expiration message
> Let's say the above token was created, renewed several times, and then
> revoked. The following message shows up in the log file TTL seconds after
> the last renewal:
> [INFO] expire: revoked 'auth/token/renew-self/devtoken
> What do I need to do to eliminate that message?
You don't. When you revoke a token directly the expiration timer still
exists, and it's currently actually difficult to have the token
revocation action stop the expiration timer since within the Vault
core the data is purposefully kept separate from each other. So when
the expiration timer fires it logs this message, although the token
has already been revoked.
Best,
Jeff