Add additional claims to workload identities#27786
Open
allisonlarson wants to merge 4 commits intomainfrom
Open
Add additional claims to workload identities#27786allisonlarson wants to merge 4 commits intomainfrom
allisonlarson wants to merge 4 commits intomainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds the ability for additional claims to be defined for a namespace and added to a job's workload identity. Core to this change is that JWTs are not supposed to be spoofable claims, and so any additional claims must be configured per namespace by a cluster/namespace admin and the values of the claims interpolated in the jobspec.
Namespaces can be configured to include both (or either)
required_extra_claimsandoptional_extra_claims, where required claims are added to all job's workload identities running in that namespace. Optional extra claims will be added to a job's workload identity if the jobspec includes the claim in the identitiesextra_claimslist.For a namespace example:
For the jobspec example:
This PR also adds the ability for job metadata to be interpolated into the extra claims added to the JWT.
For the above namespace and jobspec, a workload identity is generated with claims:
These extra claims are included under an
extra_claimskey, which is also used by any extra claims added via thevaultblock identities. In the case there are conflicting claims (where thevaultblock and theidentityblock is defined with the same claim and different values), thevaultblock will currently take precedence.Testing & Reproduction steps
Added unit tests, and tested manually with consul & vault integrations and examining the JWT generated
Links
#19438
internal ref: https://hashicorp.atlassian.net/browse/NMD-408
Contributor Checklist
changelog entry using the
make clcommand.ensure regressions will be caught.
and job configuration, please update the Nomad product documentation, which is stored in the
web-unified-docsrepo. Refer to theweb-unified-docscontributor guide for docs guidelines.Please also consider whether the change requires notes within the upgrade
guide. If you would like help with the docs, tag the
nomad-docsteam in this PR.Reviewer Checklist
backporting document.
in the majority of situations. The main exceptions are long-lived feature branches or merges where
history should be preserved.
within the public repository.
Changes to Security Controls
Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.