-
Notifications
You must be signed in to change notification settings - Fork 283
Initial work for introducing openssl/boringssl as a TLS provider #956
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
Conversation
ruslts * Added support for openssl * Testing out Boringssl * Compilation features flags (openssl-tls, rustls-tls, boring-tls) Signed-off-by: Arnar Páll <[email protected]>
ruslts * Added support for openssl * Testing out Boringssl * Compilation features flags (openssl-tls, rustls-tls, boring-tls) Signed-off-by: Arnar Páll <[email protected]>
Signed-off-by: Arnar Páll <[email protected]>
Signed-off-by: Arnar Páll <[email protected]>
Signed-off-by: Arnar Páll <[email protected]>
…rated Signed-off-by: Arnar Páll <[email protected]>
In order to achieve this we have to build from a fork of boring since a pull request is still in flight Signed-off-by: Arnar Páll <[email protected]>
Signed-off-by: Arnar Páll <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll continue looking at the feature flagging scheme to see what changes we can make to our APIs to support this better. In the meantime it would be great to minimize the dependencies for boring-sys.
apt install -y \ | ||
time \ | ||
cmake \ | ||
golang \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need golang here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah that's crazy, the boring-sys crate uses go as part of the whole build process.
We probably have to figure out a better way to handle this docker file.
Cargo.lock
Outdated
[[package]] | ||
name = "env_logger" | ||
version = "0.8.3" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't need to pull in env-logger... Is this coming from one of the new dependencies?
env-logger should only be needed by binary entry points and not by libraries. And for libraries, the tracing
crate is definitely preferable.
name = "ansi_term" | ||
version = "0.11.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, this pulls in a second (older) version of ansi_term
. It would be best if we could avoid these duplicate deps.
] | ||
|
||
[[package]] | ||
name = "clap" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a command-line parsing crate. Why is this getting pulled in?
name = "boring-sys" | ||
version = "1.1.1" | ||
source = "git+https://github.com/netapp/boring?branch=feat/fips-support#85d02f09741053f7af55a1074d5c272d0a79b27c" | ||
dependencies = [ | ||
"bindgen", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like boring-sys should use bindgen without default features (https://github.com/rust-lang/rust-bindgen/blob/b60339ece3994868a55889b7f1f6043ab29ba30e/Cargo.toml#L74-L80) to avoid pulling in unnecessary dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specifically, pulling in log
is okay; but pulling in env_logger
is undesirable. It seems, though, that bindgen doesn't expose distinct dependencies.
Is bindgen actually a runtime dependency or is it only a build-time dependency? If the latter, it should probably be in dev-dependencies
and not dependencies
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah, I see now that it is indeed a build-only dependency in boring-sys. It's probably less of an issue if these aren't actually pulled into the runtime, then.
Also note that we'll need some DCO sign-off for this change. See https://github.com/linkerd/linkerd2/blob/main/CONTRIBUTING.md#developer-certificate-of-origin. Note that it's not necessary to squash/amend all commits with the sign-off if long as you make a public statement in the PR. |
Co-authored-by: Oliver Gould <[email protected]>
I agree to the DCO for all the commits in this PR. |
It looks like the
I suspect related to feature-flagging and conditional compilation. |
I don't think the build dependencies are actually a blocker, though we'll probably need to update deny.toml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i gave this a quick review focusing mostly on style and idiomatic Rust --- I'd like to look closer at the feature-flagging strategy here in the future. the overall strategy --- incapsulating rustls
/openssl
/boringssl
-specific implementation details in private modules that are wrapped by backend-agnostic types to expose them to the rest of the codebase --- definitely looks correct!
some general notes:
-
i noticed there's a very large number of
unwrap()
s in this PR.unwrap
will cause the process to panic (crash instantly).in general, we should try to avoid using
unwrap()
, even for errors that are unrecoverable and should cause the proxy to panic --- we should preferexpect
for fatal errors, becauseexpect
includes a message. in general, we should try to include messages for these errors explaining why the error is fatal and/or why we expect it to not occur in normal operation. -
also, i noticed that there are a lot of
println!
s, presumably for locally debugging while working on this change. before we merge this, we should try to remove those, or replace them with logging if that information is valuable to record in production. -
some error-handling boilerplate could probably be simplified a lot by using the
?
operator in more places
use std::fmt::Formatter; | ||
|
||
#[derive(Clone, Debug)] | ||
pub struct Key(pub Arc<PKey<Private>>); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: it looks like the intention of this module is to hide the openssl/boringssl-specific implementation details behind this module's abstraction boundary, so that the rest of the project can be agnostic over whether we are using openssl or rustls?
if so, i think this field should not be pub
, to avoid leaking implementation details:
pub struct Key(pub Arc<PKey<Private>>); | |
pub struct Key(Arc<PKey<Private>>); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I totally agree.
I'm looking into what is the best solution here. The reason why this is public at this time is because of the identity vs tls modules.
When constructing a TlsConnector I need access to the primitive type Pkey from within the tls module.
I'm pretty sure this is something that can be solved by implementing From
and Into
traits but I'm not seeing the solution at this time.
Co-authored-by: Eliza Weisman <[email protected]>
Co-authored-by: Eliza Weisman <[email protected]>
@hawkw @olix0r could you guys give the pull request another look over ? I believe I've fixed most of your concerns @hawkw aside from the public fields in a few places. It would be awesome if we could perhaps try to sync up at some point and figure out a good way to hide these fields. I have not fixed the build/dependency issues that you mentioned @olix0r I will circle back to that. |
Codecov Report
@@ Coverage Diff @@
## main #956 +/- ##
==========================================
- Coverage 74.45% 73.38% -1.08%
==========================================
Files 233 238 +5
Lines 14671 15041 +370
==========================================
+ Hits 10924 11038 +114
- Misses 3747 4003 +256
Continue to review full report at Codecov.
|
Last week I spent a few days trying to rework the TLS and identity modules. That work is incomplete but shared here. The summary is:
I had to put this down to focus on inbound policy changes, but I should be able to revive this work once our access policy work lands. |
…troduce-openssl-bindings
Since openssl in it's current form is not going to be fips validated and a new version is in the works that will require api changes anyway the decision has been made that we should only support boringssl. This simplifies the feature flagging as well as feature compilations quite a bit
Closing this out in favor of #1351, which takes advantage of recent API changes to support compilation with There are some issues we'll need to resolve before merging that. Notably: ALPN support & trust anchor parsing |
In order be able to support running linkerd in fips compliant mode we need replace rustls and ring with openssl
since ring is not fips validated/compliant.