Skip to content

Support credentials forwarding in Kubernetes Access#23978

Merged
tigrato merged 1 commit intomasterfrom
tigrato/forward-user-identity-impl
Apr 6, 2023
Merged

Support credentials forwarding in Kubernetes Access#23978
tigrato merged 1 commit intomasterfrom
tigrato/forward-user-identity-impl

Conversation

@tigrato
Copy link
Copy Markdown
Contributor

@tigrato tigrato commented Apr 3, 2023

This PR introduces a new process for forwarding the user's identity for Kubernetes Access.

The identity forwarding is only enabled if all the kube_servers support the new impersonation mechanism and if the request isn't forwarded into a remote cluster. Remote clusters still use mTLS where the user identity is embedded in a proxy-cached certificate.

Only proxies are allowed to impersonate users.

In Teleport 14 we will remove all the mTLS code and we will support impersonation only.

The following benchmarks show the improvement between old and new versions.

Old: mTLS benchmark

Histogram

Percentile Response Duration 
---------- ----------------- 
25         31 ms             
50         32 ms             
75         33 ms             
90         33 ms             
95         37 ms             
99         44 ms             
100        88 ms   

New: Impersonation benchmark

Histogram

Percentile Response Duration 
---------- ----------------- 
25         10 ms             
50         11 ms             
75         12 ms             
90         15 ms             
95         15 ms             
99         20 ms             
100        23 ms     

Part of #22533
Closes #21609

@tigrato tigrato force-pushed the tigrato/forward-user-identity-impl branch 4 times, most recently from 4cb73b8 to 2d0bb77 Compare April 3, 2023 13:08
@tigrato tigrato marked this pull request as ready for review April 3, 2023 13:27
@tigrato tigrato force-pushed the tigrato/forward-user-identity-impl branch from 2d0bb77 to 5f1aaca Compare April 3, 2023 15:50
Comment thread lib/kube/proxy/transport.go Outdated
Comment thread lib/kube/proxy/transport.go Outdated
Comment thread lib/kube/proxy/transport.go Outdated
Comment thread lib/kube/proxy/transport.go Outdated
Comment thread lib/kube/proxy/transport.go Outdated
Comment thread lib/kube/proxy/transport.go Outdated
Comment thread lib/kube/proxy/transport_test.go Outdated
@tigrato tigrato force-pushed the tigrato/forward-user-identity-impl branch 6 times, most recently from 69101ec to 6851b2c Compare April 4, 2023 17:19
@espadolini espadolini self-requested a review April 5, 2023 09:58
Comment thread lib/kube/proxy/forwarder.go Outdated
Comment thread lib/kube/proxy/forwarder_test.go Outdated
Comment thread lib/kube/proxy/transport.go Outdated
Comment thread lib/kube/proxy/transport.go Outdated
Comment thread lib/kube/proxy/transport.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it might be legal for a v14 cluster to have a v13 leaf with v12 proxies, so maybe we should delete this in v15?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It won't be a problem.

the root proxy will dial to the leaf proxy using the new impersonated method. Leaf proxy will dial to the kubernetes service using the old method since kubernetes service does not support it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The issue is that I don't think that we specify how old the components of the leaf cluster can be; if we interpret "leaf cluster version" to mean both auth and proxy (which is the sensible interpretation, I think) then you're right, we can delete it in v14.

The alternative would be that the leaf auth is one version behind and then the leaf proxy is one version behind its auth, but that would mean that the remote cluster reverse tunnel needs to stay compatible for two major versions of the proxy, which is kind of a tall order.

Comment thread lib/kube/proxy/transport.go Outdated
Comment thread lib/kube/proxy/transport.go Outdated
@tigrato tigrato requested a review from espadolini April 5, 2023 18:15
@tigrato tigrato force-pushed the tigrato/forward-user-identity-impl branch from fe96b4f to 7f7da72 Compare April 5, 2023 19:46
@public-teleport-github-review-bot public-teleport-github-review-bot Bot removed the request for review from timothyb89 April 6, 2023 08:33
This PR introduces a new process for forwarding the user's identity for Kubernetes Access.

The identity forwarding is only enabled if all the `kube_servers` support the new impersonation mechanism and if the request isn't forwarded into a remote cluster. Remote clusters still use mTLS where the user identity is embedded in a proxy-cached certificate.

Only proxies are allowed to impersonate users.

In Teleport 14 we will remove all the mTLS code and we will support impersonation only.

The following benchmarks show the improvement between old and new versions.

```
Histogram

Percentile Response Duration
---------- -----------------
25         31 ms
50         32 ms
75         33 ms
90         33 ms
95         37 ms
99         44 ms
100        88 ms
```

```
Histogram

Percentile Response Duration
---------- -----------------
25         10 ms
50         11 ms
75         12 ms
90         15 ms
95         15 ms
99         20 ms
100        23 ms

```

Part of #22533
Closes #21609
@tigrato tigrato force-pushed the tigrato/forward-user-identity-impl branch from 7f7da72 to a0b8fa2 Compare April 6, 2023 10:09
@tigrato tigrato added this pull request to the merge queue Apr 6, 2023
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 6, 2023
@tigrato tigrato added this pull request to the merge queue Apr 6, 2023
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 6, 2023
@tigrato tigrato added this pull request to the merge queue Apr 6, 2023
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 6, 2023
@tigrato tigrato added this pull request to the merge queue Apr 6, 2023
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 6, 2023
@tigrato tigrato added this pull request to the merge queue Apr 6, 2023
Merged via the queue into master with commit 9a4cc8f Apr 6, 2023
@tigrato tigrato deleted the tigrato/forward-user-identity-impl branch April 6, 2023 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Drop the requirement of using the credentials cache in Kube Proxy

3 participants