A purpose-built proxy for the Linkerd service mesh. Written in Rust.
Go to file
Eliza Weisman c7918cfb1f
outbound: handle `Opaque` protocol hints on endpoints (#2237)
Currently, when the outbound proxy makes a direct connection prefixed
with a `TransportHeader` in order to send HTTP traffic, it will always
send a `SessionProtocol` hint with the HTTP version as part of the
header. This instructs the inbound proxy to use that protocol, even if
the target port has a ServerPolicy that marks that port as opaque, which
can result in incorrect handling of that connection. See
linkerd/linkerd2#9888 for details.

In order to prevent this, linkerd/linkerd2-proxy-api#197 adds a new
`ProtocolHint` value to the protobuf endpoint metadata message. This
will allow the Destination controller to explicitly indicate to the
outbound proxy that a given endpoint is known to handle all connections
to a port as an opaque TCP stream, and that the proxy should not perform
a protocol upgrade or send a `SessionProtocol` in the transport header.
This branch updates the proxy to handle this new hint value, and adds
tests that the outbound proxy behaves as expected.

Along with linkerd/linkerd2#10301, this will fix linkerd/linkerd2#9888.

I opened a new PR for this change rather than attempting to rebase my
previous PR #2209, as it felt a bit easier to start with a new branch
and just make the changes that were still relevant. Therefore, this
closes #2209.
2023-04-13 14:09:01 -07:00
.checksec release: Produce static binaries (#2057) 2022-12-12 16:10:11 -08:00
.devcontainer dev: override CXX for rust-analyzer (#2270) 2023-02-26 17:56:10 -08:00
.github build(deps): bump actions/checkout from 3.3.0 to 3.5.0 (#2349) 2023-03-29 13:45:59 -07:00
docs ci: Lint markdown files (#1707) 2022-05-25 11:46:19 -07:00
hyper-balance Make all comment delimeters uniform (#2120) 2023-01-04 19:00:18 -08:00
linkerd outbound: handle `Opaque` protocol hints on endpoints (#2237) 2023-04-13 14:09:01 -07:00
linkerd2-proxy Add the `meshtls-boring-fips` feature flag (#2168) 2023-01-24 12:11:19 -08:00
opencensus-proto build(deps): bump prost-build from 0.11.4 to 0.11.5 (#2087) 2022-12-29 15:38:18 -08:00
tools chore: update `tonic`, `prost`, and `proxy-api` (#1868) 2022-08-05 10:00:40 -07:00
.clippy.toml clippy: Disallow lock and instant types from `std` (#1458) 2022-02-02 11:59:03 -08:00
.dockerignore Add proxy_build_info metric (#600) 2020-07-24 09:19:40 -07:00
.gitattributes Update to linkerd2-proxy-api v0.5 and tonic v0.7 (#1596) 2022-04-11 11:29:33 -07:00
.gitignore fuzz: Omit lockfiles from version control (#1088) 2021-06-16 17:08:16 -07:00
CONTRIBUTING.md dev: Update markdowlint-cli2 to 5.0.1 (#1892) 2022-08-15 13:42:18 -07:00
Cargo.lock build(deps): bump cmake from 0.1.49 to 0.1.50 (#2365) 2023-04-13 10:39:32 -07:00
Cargo.toml update `linkerd2-proxy-api` to v0.9.0 from crates.io (#2384) 2023-04-10 10:39:04 -07:00
DCO Add contributing doc and DCO file (#88) 2017-12-22 14:54:27 -08:00
Dockerfile ci: Add a linkerd install workflow (#2268) 2023-02-27 10:37:44 -08:00
GOVERNANCE.md ci: Lint markdown files (#1707) 2022-05-25 11:46:19 -07:00
LICENSE Introducing Conduit, the ultralight service mesh 2017-12-05 00:24:55 +00:00
MAINTAINERS.md ci: Lint markdown files (#1707) 2022-05-25 11:46:19 -07:00
README.md README: comment just-cargo and make it more clear (#2292) 2023-03-07 13:07:35 -08:00
deny.toml Add the `meshtls-boring-fips` feature flag (#2168) 2023-01-24 12:11:19 -08:00
justfile just: Fix docker tag formatting (#2312) 2023-03-11 17:39:35 -08:00
rust-toolchain dev: Update to dev:v32 with Rust 1.64 (#1961) 2022-10-21 10:21:12 -07:00

README.md

The Linkerd Proxy

linkerd2

GitHub license Slack Status

This repo contains the transparent proxy component of Linkerd2. While the Linkerd2 proxy is heavily influenced by the Linkerd 1.X proxy, it comprises an entirely new codebase implemented in the Rust programming language.

This proxy's features include:

  • Transparent, zero-config proxying for HTTP, HTTP/2, and arbitrary TCP protocols.
  • Automatic Prometheus metrics export for HTTP and TCP traffic;
  • Transparent, zero-config WebSocket proxying;
  • Automatic, latency-aware, layer-7 load balancing;
  • Automatic layer-4 load balancing for non-HTTP traffic;
  • Automatic TLS (experimental);
  • An on-demand diagnostic tap API.

This proxy is primarily intended to run on Linux in containerized environments like Kubernetes, though it may also work on other Unix-like systems (like macOS).

The proxy supports service discovery via DNS and the linkerd2 Destination gRPC API.

The Linkerd project is hosted by the Cloud Native Computing Foundation (CNCF).

Building the project

We use just-cargo which provide a thin wrapper around just and cargo.

We recommend that you use the included Dev Container to avoid setting up the complex development environment by hand.

Just

A justfile is provided to automate most build tasks. It provides the following recipes:

  • just build -- Compiles the proxy on your local system using cargo
  • just test -- Runs unit and integration tests on your local system using cargo
  • just docker -- Builds a Docker container image that can be used for testing.

Cargo

Usually, Cargo, Rust's package manager, is used to build and test this project. If you don't have Cargo installed, we suggest getting it via https://rustup.rs/.

Devcontainer

A Devcontainer is provided for use with Visual Studio Code. It includes all of the tooling needed to build and test the proxy.

Repository Structure

This project is broken into many small libraries, or crates, so that components may be compiled & tested independently. The following crate targets are especially important:

Code of conduct

This project is for everyone. We ask that our users and contributors take a few minutes to review our code of conduct.

Security

We test our code by way of fuzzing and this is described in FUZZING.md.

A third party security audit focused on fuzzing Linkerd2-proxy was performed by Ada Logics in 2021. The full report is available here.

License

linkerd2-proxy is copyright 2018 the linkerd2-proxy authors. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use these files except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.