Skip to content

quiche: add fake implemention of QuicProofSource and QuicProofVerifier#7328

Merged
mattklein123 merged 20 commits intoenvoyproxy:masterfrom
danzh2010:fakeproof
Jul 1, 2019
Merged

quiche: add fake implemention of QuicProofSource and QuicProofVerifier#7328
mattklein123 merged 20 commits intoenvoyproxy:masterfrom
danzh2010:fakeproof

Conversation

@danzh2010
Copy link
Copy Markdown
Contributor

@danzh2010 danzh2010 commented Jun 19, 2019

This pair will be replaced by actual EnvoyQuicProofSource/Verifier. Before that, we use faked ones to integrate with quiche code.
Update quiche tarball to commit 8f3a576515ada564d3e2b560220649f49a21dec1

Risk Level: low, temporary use, not to be used in production
Testing: added new tests for the faked behavior. Since boringssl QUIC interface is not present in FIPS yet, quic targets are disabled in compile_option_ci using nofips tag.
Part of #2557

danzh1989 added 9 commits May 8, 2019 12:12
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
This reverts commit 9914fb4.

Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
@danzh2010
Copy link
Copy Markdown
Contributor Author

/assign @wu-bin @alyssawilk

Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
@danzh2010
Copy link
Copy Markdown
Contributor Author

/retest

@repokitteh-read-only
Copy link
Copy Markdown

🔨 rebuilding ci/circleci: tsan (failed build)

🐱

Caused by: a #7328 (comment) was created by @danzh2010.

see: more, trace.

Copy link
Copy Markdown
Contributor

@wu-bin wu-bin left a comment

Choose a reason for hiding this comment

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

Thanks Dan. LGTM modulo some nits.

namespace Quic {

// A dummy implementation of quic::ProofSource which returns a dummy cert and
// a fake signature for given QUIC server config.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: for a given QUIC server config.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

std::unique_ptr<quic::ProofVerifierCallback> callback) override {
if (VerifyCertChain(hostname, certs, "", cert_sct, context, error_details, details,
std::move(callback)) == quic::QUIC_SUCCESS &&
signature == absl::StrCat("Dummy signature for { ", server_config, " }")) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we put the StrCat call into a function, and use it from here and EnvoyQuicFakeProofSource::ComputeTlsSignature?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I thought about this, but ideally ProofSource and ProofVerifier shouldn't depends on each other and it's not worth to add another library for helper function used by fake implementations.

const quic::ProofVerifyContext* /*context*/, std::string* /*error_details*/,
std::unique_ptr<quic::ProofVerifyDetails>* /*details*/,
std::unique_ptr<quic::ProofVerifierCallback> /*callback*/) override {
std::string cert = absl::StrCat("Dummy cert from ", hostname);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Similar to above, put "Dummy cert from {}" and "Dummy timestamp" into functions, use them from here and EnvoyQuicFakeProofSource.

namespace Envoy {
namespace Quic {

// A dummy implementation of quic::ProofVerifier which approves the certs and
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: For consistency, how about replace all mentions of "dummy" to "fake", in fake_proof_verifier and fake_proof_source?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

canonicalizer
cardinality
casted
chlo
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: This is not needed, see the beginning of this file. Adding "CHLO" will also accept "chlo" or "Chlo".

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

removed

std::vector<std::string> expected_certs_;
};

class EnvoyQuicProofSourceTest : public ::testing::Test {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: How about EnvoyQuicFakeProofSourceTest?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

TEST_F(EnvoyQuicProofSourceTest, TestGetProof) {
auto callback = std::make_unique<TestGetProofCallback>(expected_signature_, "Dummy timestamp",
expected_certs_);
proof_source_.GetProof(server_address_, hostname_, server_config_, version_, chlo_hash_,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we also check that "callback" is actually executed by GetProof?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Signed-off-by: Dan Zhang <danzh@google.com>
@danzh2010
Copy link
Copy Markdown
Contributor Author

/retest

@repokitteh-read-only
Copy link
Copy Markdown

🔨 rebuilding ci/circleci: compile_time_options (failed build)

🐱

Caused by: a #7328 (comment) was created by @danzh2010.

see: more, trace.

wu-bin
wu-bin previously approved these changes Jun 20, 2019
)

envoy_cc_library(
name = "quic_core_crypto_proof_source_interface",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: Please keep the libraries name in sync with their internal names. Same for quic_core_crypto_proof_verifier_interface.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Switched to quic_core_crypto_crypto_handshake_lib after sync'ing #7340.

Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
@danzh2010
Copy link
Copy Markdown
Contributor Author

compile_time_options ci fixed by disabling all quic related tests via tag nofips. PTAL

wu-bin
wu-bin previously approved these changes Jun 27, 2019
Copy link
Copy Markdown
Contributor

@wu-bin wu-bin left a comment

Choose a reason for hiding this comment

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

Thanks Dan. This looks good to me, but I'm not familiar with ssl, can you get a second eye on the "nofips" filtering?

@danzh2010
Copy link
Copy Markdown
Contributor Author

/assign @mattklein123 @htuch

Signed-off-by: Dan Zhang <danzh@google.com>
@htuch htuch removed their assignment Jun 28, 2019
Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

LGTM from a skim with a question. Thank you!

/wait-any

# Building all the dependencies from scratch to link them against libc++.
echo "Building..."
bazel build ${BAZEL_BUILD_OPTIONS} ${COMPILE_TIME_OPTIONS} -c dbg //source/exe:envoy-static
bazel build ${BAZEL_BUILD_OPTIONS} ${COMPILE_TIME_OPTIONS} -c dbg //source/exe:envoy-static --build_tag_filters=-nofips
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry what is the TLDR on all the nofips changes?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

QUIC relies on some boringssl hooks that aren't in the (current) fips boringssl release.
I suggested to Dan that we just opt QUIC out of the FIPS build because of that. I didn't realize that our debug build used the fips boringssl build though :-/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this is the "compile time options" build.

What is preventing us from just building/testing QUIC in the normal build at this point?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I just documented the issue in #7433, but basically is what Alyssa explained.

nofip tag is only excluded from compile-time-options build. And in normal build we can still run and test QUIC integration code.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

OK. Are we building QUIC in the normal release build now though? Or is it only compile time options?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, we build and test QUIC in all CI's except for compile-time-options.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

OK sounds good.

@mattklein123 mattklein123 merged commit cf1954e into envoyproxy:master Jul 1, 2019
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.

6 participants