-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Conversation
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 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 |
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 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(); |
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.
@halter73 introduced IsTestMock because he wasn't using a real cert here. Something about not wanting to create a large number of real certs.
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.
Is that a real problem?
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.
When @halter73 is back, if the test haven't exploded by then can give me some feedback.
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'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.
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.
The second PR does it. I'll do the work in there.
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