Skip to content

http3: improving upstream TLS code - #16281

Merged
alyssawilk merged 7 commits into
envoyproxy:mainfrom
alyssawilk:reload_safe
May 6, 2021
Merged

alyssawilk merged 7 commits into
envoyproxy:mainfrom
alyssawilk:reload_safe

Conversation

@alyssawilk

@alyssawilk alyssawilk commented May 3, 2021 •

Copy link
Copy Markdown
Contributor

Addressing a TODO for upstream quic crypto. The clientContextConfig looks safe to access, as it does not reload, but QUIC was using the context to create a fresh Tls::ClientContextImpl per connection instead of reusing the factory built shared Ssl::ClientContextSharedPtr. Moving over to the shared pointer means also

  • Moving QUIC code to referencing Ssl::Context API instead of accessing the class directly (annoying down cast)
  • being able to move TimeSource out of a ton of APIs (could punt to a follow-up if preferred)

Risk Level: low (mostly H3 only)
Testing: n/a (refactor)
Docs Changes: n/a
Release Notes: n/a
part of #15649

@antoniovicente antoniovicente left a comment

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.

Looks good. Could you merge upstream/main and resolve conflicts?

Comment thread include/envoy/ssl/context.h Outdated
* @return true if the certificate chain is verified, false otherwise.
*/
virtual bool verifyCertChain(x509_st& /*leaf_cert*/, stack_st_X509& /*intermediates*/,
std::string& /*error_details*/) {

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.

Should this interface method also be PURE?

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 think it'd be a mess due to the openssl / boringssl requirement. I'll add a comment.

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.

For that reason, I'm really not a fan of having boring/openssl types in the interface at all. Can we do something to hide the types here?

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 think the other option is to dynanmic cast the interface to the impl over in source/common/quic/envoy_quic_proof_verifier.cc Want me to go that route?

@ggreenway ggreenway May 4, 2021 •

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 that's probably better. Especially because how these types are declared/defined in boring/openssl is unique.

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.

I wonder if use of pointers instead of references would play better with test mocks. I see you undid this change in a more recent update, I guess that also works.

alyssawilk added 2 commits May 4, 2021 09:03
Signed-off-by: Alyssa Wilk <[email protected]>
alyssawilk added 4 commits May 4, 2021 10:22
Signed-off-by: Alyssa Wilk <[email protected]>
Signed-off-by: Alyssa Wilk <[email protected]>
Signed-off-by: Alyssa Wilk <[email protected]>
/**
* Create transport socket factory for Quic upstream transport socket.
* @param context supplies the port to connect to on localhost.
* @param san_to_match configs |context| to match Subject Alternative Name during certificate

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.

this comment is still valid?

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.

yep. I took out args which no longer existed though didn't add comments for things others had added as it's only a test util.

@antoniovicente antoniovicente left a comment

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.

Thanks.

Comment thread include/envoy/ssl/context.h Outdated
* @return true if the certificate chain is verified, false otherwise.
*/
virtual bool verifyCertChain(x509_st& /*leaf_cert*/, stack_st_X509& /*intermediates*/,
std::string& /*error_details*/) {

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.

I wonder if use of pointers instead of references would play better with test mocks. I see you undid this change in a more recent update, I guess that also works.

@alyssawilk
alyssawilk merged commit 185e483 into envoyproxy:main May 6, 2021
@alyssawilk
alyssawilk deleted the reload_safe branch August 18, 2021 13:59
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.

4 participants