questions ... i can see how to use `puppet access ...
# puppet-enterprise
j
questions ... i can see how to use
puppet access login
to create a token for an RBAC user, and i can see the underlying API calls ... (1) there is an API call to delete (revoke?) a currently active token before it expires, is there a simple way to do this from the command line, like a
puppet access delete
command? ... (2) is there a way, from the command line or using an API call, to get a LIST of currently active tokens and when they expire?
FWIW i see the API call which returns information about a token, including when it expires, but it requires that you already know the token value itself. i'm looking for a way to verify whether a given user (like the
deploy
user) currently has any tokens or not, and when they expire.
it seems to me that (1) the tokens are stored in a database somewhere, (2) because the tokens are essentially passwords, the database would contain hashes of the token rather than the tokens themselves, and (3) each token should have some kind of ID value which can be used to identify and manage the token, but which is not the token and therefore cannot be used to authenticate
FWIW i'm not against using
psql
to run a
SELECT
query if that's the only option, but i'd rather stick to officially supported methods if at all possible
j
For deleting, there is a tokens Delete API: DELETE /tokens | Puppet Enterprise (PE) | 2025.6 It accepts usernames, that might meet your first need?
j
deleting tokens isn't something we'll be doing regularly enough to need to script it. my biggest need right now is for a supported way to LIST the existing tokens (i know how to SELECT them from the
pe-rbac
database, i just don't want to do that if i can avoid it)
j
Just digging through the docs, I don't see something obvious in the v2 of the RBAC API, but there is something in v1: <https://help.puppet.com/pe/current/topics/rbac-api-v1-users-user-id-tokens.htm%7CGET /users/<sid>/tokens | Puppet Enterprise (PE) | 2025.6> Would that do what you need?
j
looks like it ... i guess it didn't occur to me that you would use a "token" endpoint to create a token, but use a "user" endpoint to query them ... if
POST /auth/token
creates a token, i would have figured
GET /auth/token
would return a list of token IDs, and
GET /auth/token/ID
would return details about a specific token