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

Minimal changes to support certificate chain-preloading at startup #24934

Merged
merged 1 commit into from
Aug 17, 2020

Conversation

davidfowl
Copy link
Member

@davidfowl davidfowl commented Aug 15, 2020

This is a pre-cursor to supporting preloaded certificate chains in configuration. We resolve the certificate context outside of the connection establishment phase.

Contributes to #21512

@ghost ghost added the area-servers label Aug 15, 2020
@davidfowl davidfowl requested a review from javiercn August 15, 2020 16:43
Copy link
Member

@Tratcher Tratcher left a comment

Choose a reason for hiding this comment

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

I'll approve for now, but @halter73 will want to look at the implications for IsTestMock.

@@ -68,6 +68,13 @@ internal class SniOptionsSelector
}
}

if (sslOptions.ServerCertificate != null)
{
// This might be do blocking IO but it'll resolve the certificate chain up front before any connections are
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// This might be do blocking IO but it'll resolve the certificate chain up front before any connections are
// This might do blocking IO but it'll resolve the certificate chain up front before any connections are

@@ -761,7 +760,7 @@ public X509Certificate2 LoadCertificate(CertificateConfig certInfo, string endpo
return null;
}

var cert = new X509Certificate2();
var cert = TestResources.GetTestCertificate();
Copy link
Member

Choose a reason for hiding this comment

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

@halter73 introduced IsTestMock because he wasn't using a real cert here. Something about not wanting to create a large number of real certs.

Copy link
Member Author

Choose a reason for hiding this comment

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

Is that a real problem?

Copy link
Member Author

Choose a reason for hiding this comment

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

When @halter73 is back, if the test haven't exploded by then can give me some feedback.

Copy link
Member

Choose a reason for hiding this comment

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

I'd recommend storing the test cert in a static like we do for some other tests and removing IsTestMock since there's no longer an issue with this returning invalid certs. I guess it's no big deal if it isn't causing any slowness or reliability issues though.

Copy link
Member Author

Choose a reason for hiding this comment

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

The second PR does it. I'll do the work in there.

@davidfowl davidfowl merged commit e041390 into master Aug 17, 2020
@davidfowl davidfowl deleted the davidfowl/cert-preload branch August 17, 2020 19:20
@BrennanConroy BrennanConroy added this to the 5.0.0-rc1 milestone Aug 18, 2020
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants