-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
Preload intermediate certificates before exposing certificate to Kestrel #71
Preload intermediate certificates before exposing certificate to Kestrel #71
Conversation
src/FluffySpoon.AspNet.LetsEncrypt/Certes/LetsEncryptRenewalService.cs
Outdated
Show resolved
Hide resolved
src/FluffySpoon.AspNet.LetsEncrypt/Certes/LetsEncryptRenewalService.cs
Outdated
Show resolved
Hide resolved
src/FluffySpoon.AspNet.LetsEncrypt/Certes/LetsEncryptRenewalService.cs
Outdated
Show resolved
Hide resolved
{ | ||
// todo: wording | ||
// todo: throw? | ||
_logger.LogWarning("Was not able to build certificate chain"); |
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.
Since the VerificationFlags is AllFlags and revocation isn't requested I'm not sure (off the top of my head) if it's possible to get a false result (the only thing that would do that is ExplicitDistrust, IIRC, and we don't currently produce that on Linux).
If VerificationFlags had its default value (no flags set => all tests tested) then this would report that the intermediate couldn't be fetched (or something was expired, or something weird was going on). If that's an interesting state to differentiate, then just remove the assignment of VerificationFlags.
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 flags were copied from the logic that SSLStream performs
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 flags were copied from the logic that SSLStream performs
Yeah, SslStream is just trying to build a best-effort chain and see what it can do with that. I'm just suggesting that for logging purposes it might make sense to try to build a "normally valid" chain.
@dv00d00 it’s not revocation it’s downloading intermediates certificates. Old change the title to, populate the cache with intermediate certs before giving it to kestrel |
Looks good to me. Also, totally starstruck that @davidfowl visited my repo to review 🤩 @davidfowl got any final comments on the review fixes before I merge this? |
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.
LGTM
I had quite an epic issue with certificate verification in .net core.
Full details here: dotnet/aspnetcore#21183
TLDR: .net core 3.1 will perform an HTTP call to root authority of the certificate issuer to check if it was revoked. If this happens under load after a restart, threadpool is filled with blocking calls to check cert revocation, rendering app unresponsive.
@davidfowl suggested a workaround that can prevent this behavior.
There are several open questions marked as todo's in code