Skip to content

Add l5d-require-id header to Tap requests#3154

Merged
kleimkuhler merged 2 commits intomasterfrom
kleimkuhler/tap-require-name
Jul 30, 2019
Merged

Add l5d-require-id header to Tap requests#3154
kleimkuhler merged 2 commits intomasterfrom
kleimkuhler/tap-require-name

Conversation

@kleimkuhler
Copy link
Contributor

@kleimkuhler kleimkuhler commented Jul 28, 2019

Summary

In order for Pods' tap servers to start authorizing tap clients, the tap
controller must open TLS connections so that it can identity itself to the
server.

This change introduces the use of l5d-require-id header on outbound tap
requests.

Details

When tap requests are made by the tap controller, the Authority header is an
IP address. The proxy does not attempt to do service discovery on such requests
and therefore the connection is over plaintext. By introducing the
l5d-require-id header the proxy can require a server name on the connection.
This allows the tap controller to identity itself as the client making tap
requests. The name value for the header can be made from the Pod Spec and tap
request, so the change is rather minimal.

Proxy Changes

Testing

Unit tests for the header have not been added mainly because no test
infrastructure currently exists
to mock proxy requests. After talking with
@siggy a little about this, it makes to do in a separate change at some point
when behavior like this cannot be reliably tested through integration tests
either.

Integration tests do test this well, and will continue to do once
linkerd/linkerd2-proxy#290 lands.

Signed-off-by: Kevin Leimkuhler kleimkuhler@icloud.com

Signed-off-by: Kevin Leimkuhler <kleimkuhler@icloud.com>
@kleimkuhler kleimkuhler requested review from ihcsim and siggy July 28, 2019 00:52
@kleimkuhler kleimkuhler self-assigned this Jul 28, 2019
@kleimkuhler
Copy link
Contributor Author

This is not dependent on #3155

@l5d-bot
Copy link
Collaborator

l5d-bot commented Jul 28, 2019

Integration test results for 3747505: success 🎉
Log output: https://gist.github.com/37f619fccefb73211284ac802cfcf2c6

@kleimkuhler kleimkuhler requested a review from adleong July 29, 2019 16:33
Copy link
Member

@siggy siggy left a comment

Choose a reason for hiding this comment

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

lgtm modulo one nit and alex's comments. 🚢 👍

Signed-off-by: Kevin Leimkuhler <kleimkuhler@icloud.com>
@l5d-bot
Copy link
Collaborator

l5d-bot commented Jul 29, 2019

Integration test results for 0bc96c4: success 🎉
Log output: https://gist.github.com/66978792ff6ed8941c0cd003136acbc8

@kleimkuhler kleimkuhler requested a review from adleong July 30, 2019 16:54
Copy link
Member

@adleong adleong left a comment

Choose a reason for hiding this comment

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

⭐ 🎩

@kleimkuhler kleimkuhler merged commit 6cc52c3 into master Jul 30, 2019
@kleimkuhler kleimkuhler deleted the kleimkuhler/tap-require-name branch July 30, 2019 18:17
siggy added a commit that referenced this pull request Aug 7, 2019
PR #3154 introduced an `l5d-require-id` header to Tap requests. That
header string was constructed based on the TapByResourceRequest, which
includes 3 notable fields (type, name, namespace). For namespace-level
requests (via commands like `linkerd tap ns linkerd`), type ==
`namespace`, name == `linkerd`, and namespace == "". This special casing
for namespace-level requests yielded invalid `l5d-require-id` headers,
for example: `pd-sa..serviceaccount.identity.linkerd.cluster.local`.

Fix `l5d-require-id` string generation to account for namespace-level
requests. The bulk of this change is tap unit test updates to validate
the fix.

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
siggy added a commit that referenced this pull request Aug 8, 2019
PR #3154 introduced an `l5d-require-id` header to Tap requests. That
header string was constructed based on the TapByResourceRequest, which
includes 3 notable fields (type, name, namespace). For namespace-level
requests (via commands like `linkerd tap ns linkerd`), type ==
`namespace`, name == `linkerd`, and namespace == "". This special casing
for namespace-level requests yielded invalid `l5d-require-id` headers,
for example: `pd-sa..serviceaccount.identity.linkerd.cluster.local`.

Fix `l5d-require-id` string generation to account for namespace-level
requests. The bulk of this change is tap unit test updates to validate
the fix.

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
siggy added a commit that referenced this pull request Aug 8, 2019
PR #3154 introduced an `l5d-require-id` header to Tap requests. That
header string was constructed based on the TapByResourceRequest, which
includes 3 notable fields (type, name, namespace). For namespace-level
requests (via commands like `linkerd tap ns linkerd`), type ==
`namespace`, name == `linkerd`, and namespace == "". This special casing
for namespace-level requests yielded invalid `l5d-require-id` headers,
for example: `pd-sa..serviceaccount.identity.linkerd.cluster.local`.

Fix `l5d-require-id` string generation to account for namespace-level
requests. The bulk of this change is tap unit test updates to validate
the fix.

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants