-
Notifications
You must be signed in to change notification settings - Fork 476
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
Consider a new SVID field customization plugin #3253
Comments
I dug into X.509 certificate related fields. I think the following fields could have reasonable use cases for customization. I probably missed some:
|
With regard to the SPIRE CA certificate, I currently have the requirement to set certificatePolicies (OID 2.5.29.32) which is a standard extension. A plugin mechanism for the CA CSR could help to get extensions like this in the CA certificate. |
I agree that some additional customizations could be helpful in a variety of cases, but I am curious on more details for:
Specifically my first go-to might've been further tags for registration entries in the DB that could be smartly interpreted when minting X509 or JWT. For instance, today we have the CN/DNS configuration there. Is the concern DB load, some of those fields would be common across "all" signings (so dupe data in DB), or something else? The entries in the DB have the benefit of listing out precisely what can be expected in the ecosystem as far as issued identities, so splitting the logic between DB and a plugin IMO might add some maintainability complexities. |
Thanks for adding your thoughts here, @amoore877! We discussed this at length as we (maintainers) ourselves weren't totally settled on whether or not a 1) plugin, 2) a configurable, or additional fields on the registration entry would be more appropriate. Here are some of the things we discussed: Registration EntryPROS:
CONS:
ConfigurablesPROS:
CONS:
PluginPROS:
CONS:
There are probably others that I've missed. After weighing all this, we didn't feel super great about any of the solutions, but felt like the plugin covered more use cases. Happy to hear any additional thoughts you (or others) have! We want to land on the optimal solution :) |
this isn't necessarily true I think, depending on how loose we might allow definitions to be. For instance, we could mimic how
this is to me the biggest con, and the strongest pro for registration entry / plugin. I agree with all the pros though for plugin, and they are compelling to me. Another con though would be requiring a deployment to alter behavior, unless the external plugin implementation includes its own complexities of referencing some dynamic config / DB / other signals itself. |
I'm not sure I follow here. Can you give an example? |
So if some operators want to alter what the plugin itself is doing for their customizations of SVIDs, they either need a code change of the plugin's implementation or (if possible) a config change of it. This means deploying a new binary of the plugin (or the SPIRE deployment itself, depending on build packaging). This could be mitigated if the plugin is referencing some other dynamic source for what it should be doing, but that adds complexity and IMO is Entry approach with extra steps. Consider if operators want to alter key usage for some of the SVIDs in their ecosystem. additional pro for entry approach: when we want to update certain SVID behaviors, live SVIDs are updated through re-signings "immediately" due to entry revision change. Agents will get the new contents and any subscribing workloads will also be updated. |
Right now I would really appreciate the ability to configure custom extensions. Our PKI folks insist on setting certificatePolicies (OID 2.5.29.32) . |
An additional aspect of customization w.r.t. to the CSR for certificates of workloads and agents would be the capability to decide based on the used key material (algorithm and key length) whether a CSR is acceptable. The requirement behind is to be able to ensure that the key material for certificates issued by SPIRE can be restricted by algorithm (e.g., RSA only, e.g. selected ECC curves only) and key length. |
Hmm, that is interesting @sebastianGit. Agent CSRs are only used to convey the public key. All other fields are ignored, so as of right now agents don't get to choose the signature algorithm directly. SPIRE server uses the default signature algorithm for the key type + strength that the Go x509 package chooses. |
@azdagron : My use case is that I'm asked to make on the server-side the decision whether the agent's/workload's key material that is presented in a CSR is compliant with requirements that only selected types of key material must be supported using an explicit allow list. E.g., the server must ensure that it only issues certificates to agent's/workload's with public keys for 'RSA using 2048 bits' or 'RSA using 4048 bits' or 'ECC P-256', but NOT 'RSA using 1024 bits' or other key material. While I'm aware that the current SPIRE agents always create CSRs using 'ECC P-256', actually anybody can write an agent and send arbitrary CSRs to the SPIRE server using key material that might be compliant with the requirements of the PKI's policies or not. Currently, the only check implemented by the server is 'is the key material supported by the used go-libs' which is a rather liberal check. |
@sebastianGit, yes that makes sense. @amoore877 the quick reactivity of an entry based approach is pretty attractive. We've been pretty hesitant to open up the entry as a bucket for arbitrary key/values though. We've discussed this quite a bit and I think the maintainers are leaning towards the plugin approach. That approach doesn't preclude us from doing something with the entry in the future. I'll take a stab at a plugin interface and open a PR in the SPIRE Plugin SDK repo that I'll link here. We can figure out the right interface from there. |
Another use case I can imagine for something like this is to customize the Subject of an Agent X.509-SVID such that it can be used as a client certificate to the kubelet in the k8s WorkloadAttestor plugin. This would greatly reduce friction in managing kubelet client credentials for cases where the agent needs to talk to the kubelet but is not deployed by Kubernetes. |
Off the back of the issue mentioned above, we'd love to see a default customization plugin shipped with SPIRE too. The plugin could allow for generic modification of SVIDs based on templates defined in the config. I feel like that would cover a lot of use-cases where trivial modifications are desired (i.e. adding a single static claim to SVIDs), and anything more niche could be implemented with a custom plugin. |
I've made a first pass at an interface definition here. spiffe/spire-plugin-sdk#27 |
Has there been discussion about what would happen if there are multiple configured One plugin for X509s and Another for JWTs: I think it'd be fairly common for folks to create plugins for a specific type of JWT, particularly when on-boarding to SPIRE. For example, I currently have a use-case to add specific claims to JWTs but no need to update X509s. Later on, when I do have a need to set values in an X509 I'd probably want to keep that logic in its own plugin implementation. Pipeline of Work: I could see a use-case of folks using the plugins to add/set attributes and then having a final plugin instance that'll verify the entire set of SVID attributes before generation. Such a setup is a clear ordered list of operations. While one certainly could achieve both situations with a single plugin, I suspect the composability of individual plugins will be attractive and utilized. Are there rules regarding plugin execution order? |
I think allowing for multiple credential composer plugins makes the most sense. The order in which plugins are defined in the configuration is preserved in the plugin collections, at least for those that are designed to be a list (notifiers, credential composers) and not addressed by name (node attestors). That gives us something to anchor on as a natural order of operations. |
I've had a thought regarding a specific x509-visible field, and curious if it would and should be supported- a field for what Registration Entry UUID + Revision Number corresponds to the issued SVID. This would be unlikely to be used for normal operations, but it could be helpful for:
|
Hey @amoore877 - discussed this today in the SPIRE maintainer call, and consensus there was that this is an important audit feature and oversight in core. Opened #3688 to track it independently .. thanks for bringing it up. |
It is already solved |
There have been some requests to allow X509-SVID or JWT-SVID field customization. One way in which this might be achieved is by creating a new plugin type that would get a chance to modify the SVID before it was minted. Other solutions could allow for targeted customization of individual fields (i.e. X509-SVID Subject), but would not easily accommodate a wide variety of fields that might need customization.
This issue tracks the discussion of whether or not a plugin of this type would be ultimately beneficial and/or to weigh alternatives.
The text was updated successfully, but these errors were encountered: