Skip to content

Port gateway changes to tokio-0.2#546

Merged
olix0r merged 27 commits intomaster-tokio-0.2from
ver/gateway-0.2
Jun 11, 2020
Merged

Port gateway changes to tokio-0.2#546
olix0r merged 27 commits intomaster-tokio-0.2from
ver/gateway-0.2

Conversation

@olix0r
Copy link
Member

@olix0r olix0r commented May 30, 2020

Rebases master onto master-tokio-0.2

olix0r added 14 commits May 30, 2020 19:46
This change modifies the outbound proxy to fail to build services
targetting localhost:4140 (where 4140 is the outbound port). This
prevents looping and will result in 502s.
e77fe18 introduced loop detection to the outbound HTTP proxy. This
change extends this behavior to the inbound HTTP proxy and the TCP
proxy for both inbound and outbound. This helps ensure malicious
requests can't consume proxy resources.
This change adds (flakey) tests for loop detection. The tests are flakey
because they require static ports to work properly. (We cannot configure
the original dst port to be the same as the interface port if the
interface port is not known).
This change modifies the fallback layer to inspect error sources
recursively to determine if the given error type is satisfied.

A stack-helper is also added for this case.
This change does not change any functionality. It only restructures the
inbound and outbound proxy modules so that the clients and servers can
be instantiated separately. This will support gatewaying requests between
the inbound and outbound proxy.
When the proxy receives inbound requests without an original dst address
(or with a original dst address matching the inbound listener), the
proxy currently fails these requests.

This change modifies the proxy to attempt to accept these requests and
forward them back through the outbound router.

The gateway requires that all requests are received over an mTLS-secured
connection. It also refines the destination through DNS to determine the
canonical-form name as well as an outbound original dst IP. All
gatewayed destinations must have a suffix as set by the
`LINKERD2_PROXY_INBOUND_GATEWAY_SUFFIXES` environment variable.

All requests that do not meet these criteria are failed with a `403
Forbidden` status.
When the gateway forwards requests, it now adds a `Forwarded` header
including the source identity, the local identity, and the destination
authority.
This change uses the gateway's `Forwarded` header to detect if the
request has already transited through this gateway. This is
determination is made by comparing ID strings, so this will prevent
gateway daisy-chaining when clusters do not use distinct identity
domains.
This ensures that error metrics are recorded and that logging is emitted
uniformly. This also ensures that gRPC requests don't get HTTP error
responses.
This change uses the gateway's `Forwarded` header to detect if the
request has already transited through this gateway. This is
determination is made by comparing ID strings, so this will prevent
gateway daisy-chaining when clusters do not use distinct identity
domains.
@olix0r olix0r marked this pull request as ready for review June 1, 2020 21:55
olix0r added 5 commits June 3, 2020 02:47
When the inbound caches gateway services, it eagerly obtains an
outbound service to cache. If the outbound service employs a traffic
split, this inbound service is pinned to a specific leaf, and requests
will never be routed to the other leaf.

This change moves the gateway fallback to be outside all of the inbound
caches, so that outbound splits work as intended.
@olix0r olix0r requested a review from hawkw June 11, 2020 00:40
@hawkw
Copy link
Contributor

hawkw commented Jun 11, 2020

looks like this breaks several of the retry integration tests?

@olix0r olix0r changed the title Ver/gateway 0.2 Port gateway changes to tokio-0.2 Jun 11, 2020
Copy link
Contributor

@hawkw hawkw left a comment

Choose a reason for hiding this comment

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

Most of the substantial change has already been reviewed in PRs against master, so I focused on issues related to the std::future update. I noticed a few minor nits.

Also, parts of this change are definitely going to conflict with #551, so when we rebase whichever branch merges second we should be careful to make sure the tap stuff doesn't get clobbered.

Copy link
Contributor

@hawkw hawkw left a comment

Choose a reason for hiding this comment

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

Noticed one minor issue with dependencies. LGTM otherwise.

@olix0r olix0r merged commit ccf6eb0 into master-tokio-0.2 Jun 11, 2020
@olix0r olix0r deleted the ver/gateway-0.2 branch June 11, 2020 21:01
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.

2 participants