Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AppRole - Set DisplayName to Role Name (Vault #9850) #492

Open
cipherboy opened this issue Aug 27, 2024 · 0 comments
Open

AppRole - Set DisplayName to Role Name (Vault #9850) #492

cipherboy opened this issue Aug 27, 2024 · 0 comments
Assignees
Labels
feature New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@cipherboy
Copy link
Member

As @BrentSouza writes on #9850:

Is your feature request related to a problem? Please describe.

When generating dynamic secrets like db/aws credentials, the DisplayName of the auth method is included in the generated user name/user name equivalent. When using a token granted via AppRole login, the DisplayName is unset, so the user just reads as:

vault-approle-***

Whereas if I login with okta for example it would be:

vault-okta-brentsouza-***

For logging purposes in target systems, it would be nice to have some concrete relation back to the AppRole context. I think the role name makes the most sense to use since it's most likely to be meaningful for the intended purpose.

Describe the solution you'd like

Set the role name as the DisplayName when a user/service logs in via AppRole.


@joernheissler continues:

I'm trying to create SSH host certificates with vault, and the hosts authenticate with their approle. In the Key ID, {{token_display_name}} is substituted with approle. Perhaps it changed from "empty string" in the past?

From what I can see in the current source code, the value is set in the LoginCreateToken function:

https://github.com/hashicorp/vault/blob/09c92b89cc94acf47afc6d1419cab266472ddf39/vault/request_handling.go#L2010-L2016

The ldap auth method sets DisplayName to the username:

https://github.com/hashicorp/vault/blob/09c92b89cc94acf47afc6d1419cab266472ddf39/builtin/credential/ldap/path_login.go#L90-L104

The approle method doesn't the set field, so it probably is the empty string, resulting in approle.

https://github.com/hashicorp/vault/blob/09c92b89cc94acf47afc6d1419cab266472ddf39/builtin/credential/approle/path_login.go#L368-L377

Might be enough to set DisplayName: role.name?


This makes sense, but likely should be made opt-in as this might change expectations of clients. Perhaps a display_name field could be introduced to the role, taking either the form role-name or static:<name>, with the latter setting an explicit display name.

@cipherboy cipherboy added feature New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Aug 27, 2024
@DanGhita DanGhita self-assigned this Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants