Attempting to use Vault PKI engine for user-based certificates, where the common name would be userX@domain.com, and users would auth via LDAP to issue the cert. This functionally works using a PKI role with allow_glob_domains = true and allowed_domains = *@domain.com.
One role per user where allowed_domains = userX@domain.com. Poor solution, but could technically work if we develop a process to precreate roles for users. (hundreds to thousands)
Sentinel policy to evaluate common_name against user identity. Seems possible if common_name can be read from the data, but not yet tested, and obviously requires Vault Enterprise.
Ideally this would be a natively supported use case in the role options, or by supporting templating in allowed_parameters. As far as I can tell, ACL templating is still only supported in path statements. If it was supported in allowed_parameters, something like this should work:
I was actually attempting to do something similar and ran into the same problem. In my case, Iām using host-based certificates, and I want a host to be able to issue a certificate with same common name as its own as a way of renewing its own certificate without needing additional authentication.
I tried the same type of policy that you highlighted, only to learn that templating only works in paths:
# This does not work
path "pki_int/issue/example-dot-com" {
capabilities = [ "create", "update" ]
allowed_parameters = {
common_name = [ "{{identity.entity.aliases.auth_cert_5f595bf8.name}}" ]
}
}
I would also like to avoid solution 1 since I donāt want to have a role for every single user, and am using non-Enterprise.
As far as I see it, there are two ways to enable these kind of uses cases. Iām not sure which is more work because I havenāt looked at Vaultās source yet:
Allow templating in the policies outside of the path, or at least just in allowed_parameters.
Add a field to the role similar to allowed domains that can reference the identity of the invoking user, similar to how you would with a template.
In the mean time, if youāve found any work-arounds, Iād be curious to hear about them. Iām still evaluating vault, so I may abandon certificates for the time being and use something else for authentication.
Oh, good news, something I missed when searching the first time: it looks like thereās already some effort to enable some form of templating / referencing identity in the allowed domains of a cert role:
Did you ever find a solution/workaround? Even with domain templating it appears itās impossible to actually limit PKI issuing to a userās identity when using email