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

meshtls: allow building without any TLS impls enabled #1359

Merged
merged 4 commits into from
Nov 5, 2021

Conversation

hawkw
Copy link
Contributor

@hawkw hawkw commented Nov 5, 2021

Currently, the linkerd-meshtls crate cannot be compiled when no TLS
implementation feature flags are enabled. This is an issue, since it
means the rustls implementation must be enabled by default, requiring
all crates that depend on meshtls, or on a crate that depends on it,
to expose feature flags for controlling what TLS implementation(s) are
enabled. This is not ideal.

This branch changes the meshtls so that it can compile even when no
TLS implementations are enabled. The crates which actually need TLS
implementations to be enabled (the linkerd2-proxy application crate,
and linkerd-app-integration) now depend on the linkerd-meshtls crate
for the purposes of enabling feature flags. Other crates that depend on
meshtls can do so without having to propagate its feature flags.

The compile error when no TLS implementations are enabled is moved to
the linkerd2-proxy crate. linkerd-meshtls will now panic at runtime
(rather than failing to compile) if built with all TLS features disabled
(so that dependent crates don't have to enable its features), but the
proxy crate statically ensures that this cannot happen when building a
proxy.

@hawkw hawkw requested review from olix0r and a team November 5, 2021 20:01

rustls = ["linkerd-meshtls-rustls", "has_any_tls_impls"]
# Enabled if *any* TLS impl is enabled.
has_any_tls_impls = []
Copy link
Member

Choose a reason for hiding this comment

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

tioli: wdyt about prefixing this like __has_any_tls_impls to show it's internal?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i actually considered that but wasn't sure if it was necessary. i'll change it!

Signed-off-by: Eliza Weisman <[email protected]>
@olix0r olix0r merged commit d2b17de into main Nov 5, 2021
@olix0r olix0r deleted the eliza/no-default-features branch November 5, 2021 21:08
hawkw added a commit that referenced this pull request Nov 5, 2021
PR #1359 changed how `linkerd-meshtls`' TLS implementation feature flags
are enabled. After merging this PR, they should only be enabled by the
top level `linkerd2-proxy` crate, `linkerd-app-integration`, and any dev
dependencies that require a working TLS impl to be enabled for tests.
However, the `linkerd-app-core` crate already had a default-on feature
flag that enabled `meshtls-rustls`. I hadn't noticed this when working
on #1359, so I forgot to remove it.

This branch removes it. :)

Before:

```
:# eliza at noctis in linkerd2-proxy on  main [$] via ⚙️ v1.56.0
:; cargo tree -p linkerd2-proxy --no-default-features | rg 'rustls|boring'
│   │   │   │   ├── linkerd-meshtls-rustls v0.1.0 (/home/eliza/Code/linkerd2-proxy/linkerd/meshtls/rustls)
│   │   │   │   │   ├── tokio-rustls v0.22.0
│   │   │   │   │   │   ├── rustls v0.19.1

```

After:

```
:# eliza at noctis in linkerd2-proxy on  eliza/no-default-features-for-real [$+] via ⚙️ v1.56.0
:; cargo tree -p linkerd2-proxy --no-default-features | rg 'rustls|boring'

```
olix0r added a commit that referenced this pull request Nov 5, 2021
PR #1359 changed how `linkerd-meshtls`' TLS implementation feature flags
are enabled. After merging this PR, they should only be enabled by the
top level `linkerd2-proxy` crate, `linkerd-app-integration`, and any dev
dependencies that require a working TLS impl to be enabled for tests.
However, the `linkerd-app-core` crate already had a default-on feature
flag that enabled `meshtls-rustls`. I hadn't noticed this when working
on #1359, so I forgot to remove it.

This branch removes it.

Co-authored-by: Oliver Gould <[email protected]>
olix0r added a commit to linkerd/linkerd2 that referenced this pull request Nov 9, 2021
This release updates the proxy's `rustls`, `ring`, and `webpki` dependencies.

Additionally, the proxy can now be built to use a `boringssl` backend
instead of the default `rustls` backend, but this functionality is
disabled in default builds.

---

* meshtls: replace build script with `compile_error!` macro (linkerd/linkerd2-proxy#1357)
* ci: Split actions into several workflows (linkerd/linkerd2-proxy#1356)
* ci: Make job names uniform (linkerd/linkerd2-proxy#1358)
* meshtls: allow building without any TLS impls enabled (linkerd/linkerd2-proxy#1359)
* `app-core` should not enable `meshtls-rustls` (linkerd/linkerd2-proxy#1360)
* Restore rustls credential tests (linkerd/linkerd2-proxy#1363)
* build(deps): bump hex from 0.3 to 0.4 (linkerd/linkerd2-proxy#1364)
* ci: Split jobs into 'fast' and 'slow' workflows (linkerd/linkerd2-proxy#1365)
* meshtls: Move TLS e2e tests into the meshtls crate (linkerd/linkerd2-proxy#1366)
* rustls: Tidy std::task imports (linkerd/linkerd2-proxy#1367)
* build(deps): bump serde_json from 1.0.68 to 1.0.69 (linkerd/linkerd2-proxy#1368)
* build(deps): bump libc from 0.2.106 to 0.2.107 (linkerd/linkerd2-proxy#1369)
* meshtls: Add a `boring` backend (linkerd/linkerd2-proxy#1351)
* meshtls-rustls: update to `rustls` 0.20 and `tokio-rustls` 0.23 (linkerd/linkerd2-proxy#1362)
olix0r added a commit to linkerd/linkerd2 that referenced this pull request Nov 9, 2021
This release updates the proxy's `rustls`, `ring`, and `webpki` dependencies.

Additionally, the proxy can now be built to use a `boringssl` backend
instead of the default `rustls` backend, but this functionality is
disabled in default builds.

---

* meshtls: replace build script with `compile_error!` macro (linkerd/linkerd2-proxy#1357)
* ci: Split actions into several workflows (linkerd/linkerd2-proxy#1356)
* ci: Make job names uniform (linkerd/linkerd2-proxy#1358)
* meshtls: allow building without any TLS impls enabled (linkerd/linkerd2-proxy#1359)
* `app-core` should not enable `meshtls-rustls` (linkerd/linkerd2-proxy#1360)
* Restore rustls credential tests (linkerd/linkerd2-proxy#1363)
* build(deps): bump hex from 0.3 to 0.4 (linkerd/linkerd2-proxy#1364)
* ci: Split jobs into 'fast' and 'slow' workflows (linkerd/linkerd2-proxy#1365)
* meshtls: Move TLS e2e tests into the meshtls crate (linkerd/linkerd2-proxy#1366)
* rustls: Tidy std::task imports (linkerd/linkerd2-proxy#1367)
* build(deps): bump serde_json from 1.0.68 to 1.0.69 (linkerd/linkerd2-proxy#1368)
* build(deps): bump libc from 0.2.106 to 0.2.107 (linkerd/linkerd2-proxy#1369)
* meshtls: Add a `boring` backend (linkerd/linkerd2-proxy#1351)
* meshtls-rustls: update to `rustls` 0.20 and `tokio-rustls` 0.23 (linkerd/linkerd2-proxy#1362)
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