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

Don't shorten OCSP expriation on failed server OCSP fetch #96972

Merged
merged 2 commits into from
Jan 16, 2024

Conversation

rzikm
Copy link
Member

@rzikm rzikm commented Jan 15, 2024

Follow up on #96448.

Minor bug in the original implementation could potentially drop a still valid OCSP staple if we fail to refresh. The failing scenario is as follows:

  • Server fetches OCSP staple which is valid for, say 7 days
  • After 24 hours, server attempts to fetch a new staple
  • fetch fails, _nextDownload and _ocspExpiration get set to 5 seconds into the future to facilitate retry with a 5s backoff
  • if OCSP responder server is still unavailable, then after % seconds, _ocspExpiration is in the past and we stop sending the original staple.

The original intent of setting _ocspExpiration was to avoid immediate refetch if we fail on the very first OCSP fetch.

This PR makes sure we don't shorten the _ocspExpiration

@ghost
Copy link

ghost commented Jan 15, 2024

Tagging subscribers to this area: @dotnet/ncl, @bartonjs, @vcsjones
See info in area-owners.md if you want to be subscribed.

Issue Details

Follow up on #96448.

Minor bug in the original implementation could potentially drop a still valid OCSP staple if we fail to refresh. The scenario is as follows:

  • Server fetches OCSP staple which is valid for, say 7 days
  • After 24 hours, server fetches attempts to fetch a new staple
  • fetch fails, _nextDownload and _ocspExpiration get postponed 5 seconds to initiate retry
  • if OCSP responder server is still unavailable, then after % seconds, _ocspExpiration is in the past and we stop sending the original staple.

The original intent of setting _ocspExpiration was to avoid immediate refetch if we fail on the very first OCSP fetch.

This PR makes sure we don't shorten the _ocspExpiration

Author: rzikm
Assignees: -
Labels:

area-System.Net.Security

Milestone: -

Copy link
Member

@wfurt wfurt left a comment

Choose a reason for hiding this comment

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

LGTM

@rzikm
Copy link
Member Author

rzikm commented Jan 16, 2024

We potentially would want to include this in #96808 and #96838.

@wfurt
Copy link
Member

wfurt commented Jan 16, 2024

We potentially would want to include this in #96808 and #96838.

yes, I would.

@wfurt wfurt merged commit 6584a59 into main Jan 16, 2024
104 of 107 checks passed
wfurt pushed a commit to rzikm/dotnet-runtime that referenced this pull request Jan 16, 2024
* Don't shorten OCSP expriation on failed server OCSP fetch

* Code review feedback
wfurt pushed a commit to rzikm/dotnet-runtime that referenced this pull request Jan 16, 2024
* Don't shorten OCSP expriation on failed server OCSP fetch

* Code review feedback
wfurt pushed a commit that referenced this pull request Jan 16, 2024
* Add entire issuer chain to trusted X509_STORE when stapling OCSP_Response (#96792)

* Add entire issuer chain to trusted X509_STORE when validating OCSP_Response

* Code review feedback

* More code review feedback

* Update src/libraries/System.Net.Security/src/System/Net/Security/SslStreamCertificateContext.Linux.cs

Co-authored-by: Jeremy Barton <jbarton@microsoft.com>

* Fix compilation

* Always include root certificate

---------

Co-authored-by: Jeremy Barton <jbarton@microsoft.com>

* Recover from failed OCSP download. (#96448)

* Recover from failed OCSP check.

* Add 5s back-off after failed OCSP querry

* Don't shorten OCSP expriation on failed server OCSP fetch (#96972)

* Don't shorten OCSP expriation on failed server OCSP fetch

* Code review feedback

---------

Co-authored-by: Jeremy Barton <jbarton@microsoft.com>
rzikm added a commit that referenced this pull request Jan 16, 2024
* Recover from failed OCSP download. (#96448)

* Recover from failed OCSP check.

* Add 5s back-off after failed OCSP querry

* Do not OCSP staple invalid OCSP responses

* Add entire issuer chain to trusted X509_STORE when validating OCSP_Response

Code review feedback

More code review feedback

Update src/libraries/System.Net.Security/src/System/Net/Security/SslStreamCertificateContext.Linux.cs

Co-authored-by: Jeremy Barton <jbarton@microsoft.com>

Fix compilation

Always include root certificate

* Fix compilation

* Don't shorten OCSP expriation on failed server OCSP fetch (#96972)

* Don't shorten OCSP expriation on failed server OCSP fetch

* Code review feedback

---------

Co-authored-by: Kevin Jones <kevin@vcsjones.com>
Co-authored-by: Carlos Sánchez López <1175054+carlossanlop@users.noreply.github.com>
@jkotas jkotas deleted the ocsp-exipration-cut branch January 20, 2024 03:19
tmds pushed a commit to tmds/runtime that referenced this pull request Jan 23, 2024
* Don't shorten OCSP expriation on failed server OCSP fetch

* Code review feedback
@github-actions github-actions bot locked and limited conversation to collaborators Feb 19, 2024
@karelz karelz added this to the 9.0.0 milestone May 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants