Add a new role.allow.request field called kubernetes_resources#47173
Add a new role.allow.request field called kubernetes_resources#47173
role.allow.request field called kubernetes_resources#47173Conversation
|
The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with |
role.options field called request_mode.kubernetes_resources
| } | ||
|
|
||
| message AccessRequestMode { | ||
| repeated KubernetesResource KubernetesResources = 1 [ |
There was a problem hiding this comment.
Can we use a dedicated type for this setting?
Reusing the KubernetesResource gives confusion because you can set a lot of data that isn't allowed
ae41067 to
b03a2f3
Compare
945322f to
70ecfbb
Compare
|
friendly ping @tigrato @nklaassen |
70ecfbb to
352dbb1
Compare
352dbb1 to
ec9b6a8
Compare
tigrato
left a comment
There was a problem hiding this comment.
Can you please add unmarshal from/to yaml of roles with this section defined?
4892231 to
f987020
Compare
|
i made a few adjustments based on review: the request mode found on the same role as the search as roles will be enforced:
|
f987020 to
7988cc6
Compare
449ca3d to
415537c
Compare
415537c to
7f0453e
Compare
tigrato
left a comment
There was a problem hiding this comment.
In addition to these changes, you’ll also need to update the following code:
teleport/lib/kube/grpc/grpc.go
Lines 161 to 163 in 64922df
These changes are necessary to prevent users who are blocked from requesting access to specific types from being able to verify the existence of those assets in k8s.
GetSearchAsRoles must return the search as roles allowed to be used for the particular kubernetes subresource and deny if none match.
It's not a blocker but it must be released before v17
| allowedKinds, deniedKinds := getKubeResourceKinds(m.kubernetesResource.allow[requestedRoleName]), getKubeResourceKinds(m.kubernetesResource.deny) | ||
|
|
||
| // Any resource is allowed. | ||
| if allowedKinds == nil && deniedKinds == nil { |
There was a problem hiding this comment.
should we check for len(xxx)==0?
There was a problem hiding this comment.
sure i guess checking len is slightly safer b/c i'm thinking you're concerned this can happen
var array []string, by itself is nil
array := []string{} is not?
There was a problem hiding this comment.
Yeah. If someone changes the approach from using a non-initialized array to an initialized array, the code won't catch it.
| } | ||
|
|
||
| // All supported kube kinds are allowed when there was nothing configured. | ||
| if allowedKinds == nil { |
| // the access request can be reviewed. Defaults to 1 week. | ||
| requestTTL = 7 * day | ||
|
|
||
| InvalidKubernetesKindAccessRequest = `your Teleport role's "request.kubernetes_resources" field` |
b243c2f to
b98a970
Compare
b98a970 to
51998b5
Compare
51998b5 to
d69b2f5
Compare
|
🤖 Vercel preview here: https://docs-6onolp5ve-goteleport.vercel.app/docs/ver/preview |
d69b2f5 to
f8dc68e
Compare
|
🤖 Vercel preview here: https://docs-dnfaf44ij-goteleport.vercel.app/docs/ver/preview |
|
@kimlisa - this PR will require admin approval to merge due to its size. Consider breaking it up into a series smaller changes. |
|
🤖 Vercel preview here: https://docs-5jy8ahdem-goteleport.vercel.app/docs/ver/preview |
…47173) * Add a new role.allow.request field called kubernetes_resources * Fix lint: update terraform docs
part of #46742
rfd: #46691
Defines a new
role.allow.requestfield calledkubernetes_resources.For now it holds a field
kubernetes_resourcesthat follows same format as existing allow.kubernetes_resources, except the only field we support in the options field isKind(defining other fields will reject the role upserting actions).The
Kindallows admins to define what kube subresources a user can request during request creation and disallow requesting request forkube_cluster. It allows thewildcardto mean allow request to any kube subresources.If
role.allow.request.kubernetes_resourcesis not defined, or length 0, it means a user can request forkube_clusteror any of its subresources.example, if requester role says:
requesting kind
kube_clusteris denied:requesting kind
podis denied:requesting kind
namespaceis allowed:wildcard example output:
changelog: Define a new
role.allow.requestfield calledkubernetes_resourcesthat allows admins to define what kinds of Kubernetes resources a requester can make.