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

Add the option to specify a specific key id format that is generated … #2888

Merged
merged 5 commits into from
Jun 29, 2017
Merged

Conversation

broamski
Copy link
Contributor

…on the backend

@jefferai
Copy link
Member

I think if we're going to add this we need to not assume that everyone will always want the display name (since in most cases it's relatively useless). A better approach would be to use something a bit more templated, as in the SQL databases where you can provide a string with {{username}} and so.

Potential values could be {{token_display_name}}, {{role_name}}, and maybe some reasonable others.

@broamski
Copy link
Contributor Author

I agree with your recommendation, so I implemented it!

@jefferai jefferai added this to the 0.7.4 milestone Jun 20, 2017
@jefferai
Copy link
Member

Looks good. I realize the SSH CA tests aren't the easiest to deal with but could you try adding a test for this?

2.) Add test for enforcement of allow_user_key_ids when signing user
keys
@broamski
Copy link
Contributor Author

Hi @jefferai - I added the requested test and an additional test that checks the enforcement of allow_user_key_ids.

}

keyId = fmt.Sprintf("vault-%s", keyId)
keyId := substQuery(keyIdFormat, map[string]string{
"token_display_name": req.DisplayName,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens when role's KeyIDFormat mentions {{token_display_name}} and req.DisplayName is empty? I think we'll end up having a {{}} substring in keyId. Given that the role specified it, it seems reasonable to have an {{}} block. Regardless, can we have a comment here explaining that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If req.DisplayName is an empty string, the return value should be the same. Here's an example: https://play.golang.org/p/um-WzsD8RE

}

keyId = fmt.Sprintf("vault-%s", keyId)
keyId := substQuery(keyIdFormat, map[string]string{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: Can we replace Id by ID?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@jefferai jefferai merged commit 5bc4dc7 into hashicorp:master Jun 29, 2017
@jefferai jefferai modified the milestones: 0.7.4, 0.8.0 Jul 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants