I am creating a transit RSA key for signing JWTs and would like to make this policy available to any caller who can connect to the vault instance, without authentication (assuming TLS is already working on all clients, that is).
path "transit/keys/jwt-signing" {
capabilities = ["read"]
}
What combination of policies and auth backends are required to mimic the behavior present in some of the endpoints managed by the standard pki secrets engine in vault?
Taken from: https://www.vaultproject.io/api-docs/secret/pki#read-ca-certificate
»Read CA Certificate
This endpoint retrieves the CA certificate [...] in PEM format.
This is an unauthenticated endpoint. [emphasis mine]
»Sample Request
$ curl \ http://127.0.0.1:8200/v1/pki/ca/pem
I would like to expose my signing token's public part in a similar way, to construct a typical .well-known/jkws
endpoint in an API.
Completely unauthenticated access isn't supported in vault. Tokens are fundamentally tied to how vault is exposed to end users, including operators.
There is no way around it, a token will be involved in the final result, and therefore, token expiration, revocation, and renewal. Using a periodic token is the simplest approach possible.
Given that a root token is going to be used for this, creating a token includes one last quality of life feature for "public" access, which is the ability to set the token id of a created token.
When a token gets created, it needs a policy attached to it, otherwise it inherits the scope of the token which created it. For a root token, this is not desirable. Creating a policy and binding it to a token includes a special built-in policy to simplify token lifecycle tasks, the default token policy.
This default policy is going to be needed disabled, since it allows for owners of the token to access
auth/token/revoke-self
, and destroy the token's ability to be used by everyone.Using these facts, setting up access to a vault endpoint for reading the public part of a jwt signing key boils down to using the root token to:
id
value, "jwk"Here's a script to demonstrate how all this might fit together:
Which prints:
This is as close as I can get to "unauthenticated" access.
Don't forget to periodically renew this token at least once a month!