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

Add doc on new field request.kubernetes_resources #48480

Merged
merged 3 commits into from
Nov 8, 2024
Merged

Conversation

Copy link

github-actions bot commented Nov 5, 2024

🤖 Vercel preview here: https://docs-gtbutz7i0-goteleport.vercel.app/docs/ver/preview

- "kube-access"
kubernetes_resources:
- kind: "namespace"
deny: {}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
deny: {}

kubernetes_resources:
- kind: "namespace"
- kind: "pod"
deny: {}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
deny: {}

- "kube-access"
kubernetes_resources:
- kind: "*"
deny: {}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
deny: {}

# 'kubernetes_resources' restricts what kinds of Kubernetes resources
# a user can access request to. The example defined below, enforces users to
# request only Kubernetes namespaces. Default (when nothing is defined) allows
# any Kubernetes resource request.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# any Kubernetes resource request.
# access requests to any Kubernetes resource or the entire cluster.

@@ -406,6 +406,72 @@ Requesting access to a Kubernetes Namespace allows you to access all resources
in that namespace but you won't be able to access any other supported resources
in the cluster.

##### Enforce users to request only allowed Kubernetes Resources
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how does this feature interact with the previous paragraph, should it be edited at all?

Copy link
Contributor Author

@kimlisa kimlisa Nov 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it starts from here https://docs-bgpfzlzb8-goteleport.vercel.app/docs/admin-guides/access-controls/access-requests/resource-requests/#restrict-access-requests-to-specific-kubernetes-resources

and content organization is like:

> Restrict the resources a user can request access to
  > kube_cluster
    > Kubernetes resources
      > Preventing unintended access to Kubernetes resources    
      > Restrict Access Requests to specific Kubernetes resources

Comment on lines 414 to 416
The following role assigned to a user, restricts access requesting to only Kubernetes namespaces.
If a user attempts to make a request to Kubernetes resources other than `namespace` then the request
will be rejected:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does requesting access to a namespace even mean? Do you get access to anything within that namespace? Could we either explain that or use a simpler kind for this example like pod or something?

Copy link
Contributor Author

@kimlisa kimlisa Nov 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would like to keep it as namespace example as we think that'll be the most often used value

the section above this section explains restricting Kubernetes access.

i added this to the bottom of my section:

The `request.kubernetes_resources` field only restricts what `kinds` of Kubernetes resource requests are allowed.
To control Kubernetes access to these resources see 
[Preventing unintended access to Kubernetes resources](#thehash) 
section for more details.

does that help?

Comment on lines 451 to 452
The following role assigned to a user, restricts users from access requesting to a Kubernetes cluster but
allows requesting to any Kubernetes resources:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The following role assigned to a user, restricts users from access requesting to a Kubernetes cluster but
allows requesting to any Kubernetes resources:
The following role, when assigned to a user, allows them to request access to any specific
Kubernetes resource, but does *not* allow requesting access to the entire cluster.

Copy link
Contributor Author

@kimlisa kimlisa Nov 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i removed the mention of not allowing requesting access to the entire cluster here, and moved it towards the beginning of the section, see comment: https://github.com/gravitational/teleport/pull/48480/files#r1830229498

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, you and zac both gave review around same time i think, i took some of zac's suggestion over yours (or tried to combine the best parts)

docs/pages/includes/role-spec.mdx Outdated Show resolved Hide resolved
@@ -350,6 +350,13 @@ spec:
# resources accessible by the listed roles (enterprise-only)
search_as_roles: ['access']

# 'kubernetes_resources' restricts what kinds of Kubernetes resources
# a user can access request to. The example defined below, enforces users to
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# a user can access request to. The example defined below, enforces users to
# a user can request access to. In the below example, users can

deny: {}
```

By default, when `request.kubernetes_resources` field is not configured, there are no enforcements and
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
By default, when `request.kubernetes_resources` field is not configured, there are no enforcements and
If the `request.kubernetes_resources` field is not configured, then

a user can make request to any Kubernetes resources including its cluster.

See related section about [Kubernetes Resources](../../../../enroll-resources/kubernetes-access/controls.mdx/#kubernetes_resources)
to see a list of supported `kind`. Note that only the `kind` field is supported.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
to see a list of supported `kind`. Note that only the `kind` field is supported.
to see a list of supported `kind` values.

Comment on lines 451 to 452
The following role assigned to a user, restricts users from access requesting to a Kubernetes cluster but
allows requesting to any Kubernetes resources:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The following role assigned to a user, restricts users from access requesting to a Kubernetes cluster but
allows requesting to any Kubernetes resources:
The following role restricts users from requesting access to a Kubernetes cluster but
allows requesting to any Kubernetes resources:
  • Remove "assigned to a user." The sentence reads just as well without it.
  • "Access requesting" is not a verb. Let's say "requesting access" instead.
  • I don't quite understand the example - how does it restrict users from requesting access to kube clusters?

Copy link
Contributor Author

@kimlisa kimlisa Nov 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i removed the restricting users from requesting access to kube cluster phrase from this example. instead i moved it to the beginning of section like this:

The `request.kubernetes_resources` field allows you to restrict what kinds of Kubernetes 
resources a user can request access to. Configuring this field to any value will disallow
requesting access to the entire Kubernetes cluster.

If the `request.kubernetes_resources` field is not configured, then a user can request access 
to any Kubernetes resources, including the entire Kubernetes cluster.

<... insert exmaples>

does this make more sense?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep!

deny: {}
```

The following role assigned to a user, restricts access requesting to only Kubernetes namespaces and/or pods.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The following role assigned to a user, restricts access requesting to only Kubernetes namespaces and/or pods.
The following role allows users to request access only to Kubernetes namespaces and/or pods.

The `request.kubernetes_resources` field allows you to restrict what kinds of Kubernetes
resources a user can access request to.

The following role assigned to a user, restricts access requesting to only Kubernetes namespaces.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The following role assigned to a user, restricts access requesting to only Kubernetes namespaces.
The following role allows users to request access to Kubernetes namespaces.

##### Enforce users to request only allowed Kubernetes Resources

The `request.kubernetes_resources` field allows you to restrict what kinds of Kubernetes
resources a user can access request to.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
resources a user can access request to.
resources a user can request access to.

@@ -406,6 +406,72 @@ Requesting access to a Kubernetes Namespace allows you to access all resources
in that namespace but you won't be able to access any other supported resources
in the cluster.

##### Enforce users to request only allowed Kubernetes Resources
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
##### Enforce users to request only allowed Kubernetes Resources
##### Restrict Access Requests to specific Kubernetes resources

Copy link

github-actions bot commented Nov 6, 2024

🤖 Vercel preview here: https://docs-bgpfzlzb8-goteleport.vercel.app/docs/ver/preview

@kimlisa kimlisa requested review from zmb3 and nklaassen November 6, 2024 00:33
@kimlisa kimlisa enabled auto-merge November 7, 2024 21:43
@kimlisa kimlisa disabled auto-merge November 7, 2024 23:49
Copy link

github-actions bot commented Nov 7, 2024

🤖 Vercel preview here: https://docs-lahad8tpw-goteleport.vercel.app/docs/ver/preview

Copy link

github-actions bot commented Nov 8, 2024

🤖 Vercel preview here: https://docs-n5ovm722g-goteleport.vercel.app/docs/ver/preview

Copy link

github-actions bot commented Nov 8, 2024

🤖 Vercel preview here: https://docs-8ijud65tx-goteleport.vercel.app/docs/ver/preview

@kimlisa kimlisa added this pull request to the merge queue Nov 8, 2024
Merged via the queue into master with commit 4276616 Nov 8, 2024
40 checks passed
@kimlisa kimlisa deleted the lisa/update-doc branch November 8, 2024 02:50
@public-teleport-github-review-bot

@kimlisa See the table below for backport results.

Branch Result
branch/v16 Create PR
branch/v17 Create PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants