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

ssh secrets engine identity templating for allowed_domains #10943

Closed
nvx opened this issue Feb 19, 2021 · 6 comments
Closed

ssh secrets engine identity templating for allowed_domains #10943

nvx opened this issue Feb 19, 2021 · 6 comments

Comments

@nvx
Copy link
Contributor

nvx commented Feb 19, 2021

Is your feature request related to a problem? Please describe.
The PKI secrets engine allows identity templating in the allowed_domains, and the SSH secrets engine allows identity for the allowed_users field. Unfortunately the SSH secrets engine does not allow identity templating for the allowed_domains field yet.

The use case for this is similar to the existing PKI allowed_domains templating, or SSH secrets engine allowed_users templating to allow a generic role to fill data from auth identity information.

Describe the solution you'd like
Allowing identity templating in the SSH secrets engine allowed_domains field. This should be disabled by default with a new flag allowed_domains_template on the SSH role to enable this behaviour. This matches the behaviour and naming of the existing functionality in PKI and SSH secrets engines.

This should also allow partial matching, eg allowed_domains = "{{ identity.entity.name }}.example.com" (related to #10388)

Describe alternatives you've considered
Creating a role or policy for every system can be used instead, but this requires more configuration and increases the likelihood of human error and increases management overhead so is a less than ideal solution.

Explain any additional use-cases
A system can have the hostname in identity information (eg, an AppRole auth secret_id could be created with metadata including the hostname). This can allow policies to enable that system to obtain a signed SSH server certificate automatically. This is analogous to an existing use-case that is already met with the PKI secrets engine allowing a host to obtain certificates for its hostname.

Additional context
SSH secrets engine create role docs: https://www.vaultproject.io/api/secret/ssh#create-role
PKI secrets engine create role docs: https://www.vaultproject.io/api-docs/secret/pki#create-update-role

@pmmukh pmmukh added core Issues and Pull-Requests specific to Vault Core feature-request labels Sep 13, 2021
@pmmukh
Copy link
Contributor

pmmukh commented Sep 14, 2021

Hi @nvx ! Thanks for submitting this issue! We discussed this internally, and this is certainly a change that seems valid to us. I think implementing this along the lines of how allowed_domains is templated in the PKI secrets engine as you've suggested is the way we want to go too. We may not get around to implementing this soon, but I'm marking it as open for contributions, so you or anyone else is free to take a stab at this meanwhile!

@nvx
Copy link
Contributor Author

nvx commented Sep 15, 2021

Hi @nvx ! Thanks for submitting this issue! We discussed this internally, and this is certainly a change that seems valid to us. I think implementing this along the lines of how allowed_domains is templated in the PKI secrets engine as you've suggested is the way we want to go too. We may not get around to implementing this soon, but I'm marking it as open for contributions, so you or anyone else is free to take a stab at this meanwhile!

Sounds good. I'm going to focus on updating PR #7277 first, but once that's merged I'll definitely move on to this one next!

@pmmukh
Copy link
Contributor

pmmukh commented Sep 15, 2021

sounds great, and thanks!! :)

@git-noise
Copy link

Hello,
This looks indeed promising and would allow for greater security and finer control on signed-key issuance. Is it still on your todo @nvx?

Many thanks,
Best,

@f4z3r
Copy link
Contributor

f4z3r commented Jun 17, 2022

Hi guys, I looked at this issue, and it turns out this is already possible to due a feature/bug. Essentially enabling allowed_users_template will enable templating for users when signing user certificates, but also for domains when signing host certificates. I guess this is not intended.

In the coming days, I will push a PR that adds the allowed_domains_template field, enables templating for domains, and fixes the issue that allowed_users_template only enables templating for users.

f4z3r added a commit to f4z3r/vault that referenced this issue Jun 18, 2022
f4z3r added a commit to f4z3r/vault that referenced this issue Jun 18, 2022
f4z3r added a commit to f4z3r/vault that referenced this issue Aug 16, 2022
@schultz-is
Copy link
Contributor

Thanks to @f4z3r this is now implemented by #16056 . Thanks for the feature request @nvx !

cipherboy pushed a commit to cipherboy/vault that referenced this issue Aug 18, 2022
…for SSH role (hashicorp#16056)

* impr(ssh): fix bug with allowed_users_template and add allowed_domains_template field in SSH role configuration, closes hashicorp#10943

* chore: add changelog entry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants