Skip to content

Conversation

@stevendpclark
Copy link
Contributor

@stevendpclark stevendpclark commented Mar 13, 2024

Support OCSP responses without a NextUpdate value set within cert-auth OCSP verification. Responses without a NextUpdate value are allowed based on RFC6960 Section 4.2.2.1

Previous to this fix, if OCSP checks were enabled and an OCSP response didn't contain a NextUpdate value, cert auth logins would fail with a message similar to

no chain matching all constraints could be found for this login certificate; additionally got errors during verification: 1 error occurred:
* invalid validity: producedAt: 2024-02-29 17:06:00 +0000 UTC, thisUpdate: 2024-02-29 17:06:03 +0000 UTC, nextUpdate: 0001-01-01 00:00:00 +0000 UTC

Now OCSP responses without a NextUpdate field set will be allowed, the response will not be cached, as mentioned in the RFC, a lack of a NextUpdate field means there is newer revocation information available all the time.

Additional checks that the ThisUpdate field does contain a proper timestamp and is before then the current time have also been added within the list of verifications performed for us to trust an OCSP response.

A new cert auth configuration has been introduced called ocsp_this_update_max_ttl, with a default of 0. If this field is greater than 0, cert-auth will enforce an OCSP response's ThisUpdate field is less than the configured value. This can be used to avoid accepting older OCSP response values based on policies. We have avoided enforcing this by default for backwards compatibility reasons.

@stevendpclark stevendpclark added the auth/cert Authentication - certificates label Mar 13, 2024
@stevendpclark stevendpclark added this to the 1.14.11 milestone Mar 13, 2024
@stevendpclark stevendpclark self-assigned this Mar 13, 2024
@stevendpclark stevendpclark requested a review from a team as a code owner March 13, 2024 17:59
@github-actions github-actions bot added the hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed label Mar 13, 2024
@github-actions
Copy link

github-actions bot commented Mar 13, 2024

CI Results:
All Go tests succeeded! ✅

@github-actions
Copy link

github-actions bot commented Mar 13, 2024

Build Results:
All builds succeeded! ✅

@stevendpclark stevendpclark force-pushed the stevendpclark/vault-24614-ocsp-no-nextupdate branch 3 times, most recently from 571e53e to 33e60aa Compare March 15, 2024 14:54
Copy link
Collaborator

@sgmiller sgmiller left a comment

Choose a reason for hiding this comment

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

Just a couple quick questions

Default: false,
Description: "If set to true, rather than accepting the first successful OCSP response, query all servers and consider the certificate valid only if all servers agree.",
},
"ocsp_this_update_max_ttl": {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd call it max_age actually. TTL doesn't feel quite like what now() - this_update means.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed within 929d092

return true
}

if currTime.After(nextUpdate) || thisUpdate.After(nextUpdate) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

when would thisUpdate > nextUpdate? Or is this just defensive?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup completely defensive, it should never be greater.

 - Validate that the ThisUpdate value is
   properly prior to our current time and
   if NextUpdate is set that, ThisUpdate is
   before NextUpdate.
 - If we don't have a value for NextUpdate just compare against ThisUpdate.
 - Allow configuring a maximum TTL of the OCSP response based on the
   ThisUpdate time like OpenSSL does
 - Add test to validate that we don't cache OCSP responses with no NextUpdate
@sgmiller sgmiller self-requested a review March 18, 2024 21:15
stevendpclark added a commit that referenced this pull request Mar 19, 2024
* Support OCSP responses without a NextUpdate value set

 - Validate that the ThisUpdate value is
   properly prior to our current time and
   if NextUpdate is set that, ThisUpdate is
   before NextUpdate.
 - If we don't have a value for NextUpdate just compare against ThisUpdate.

* Add ocsp_this_update_max_ttl support to cert auth

 - Allow configuring a maximum TTL of the OCSP response based on the
   ThisUpdate time like OpenSSL does
 - Add test to validate that we don't cache OCSP responses with no NextUpdate

* Add cl

* Add missing ` in docs

* Rename ocsp_this_update_max_ttl to ocsp_this_update_max_age

* Missed a few TTL references

* Fix error message
stevendpclark added a commit that referenced this pull request Mar 19, 2024
* Support OCSP responses without a NextUpdate value set

 - Validate that the ThisUpdate value is
   properly prior to our current time and
   if NextUpdate is set that, ThisUpdate is
   before NextUpdate.
 - If we don't have a value for NextUpdate just compare against ThisUpdate.

* Add ocsp_this_update_max_ttl support to cert auth

 - Allow configuring a maximum TTL of the OCSP response based on the
   ThisUpdate time like OpenSSL does
 - Add test to validate that we don't cache OCSP responses with no NextUpdate

* Add cl

* Add missing ` in docs

* Rename ocsp_this_update_max_ttl to ocsp_this_update_max_age

* Missed a few TTL references

* Fix error message
stevendpclark added a commit that referenced this pull request Mar 19, 2024
* Support OCSP responses without a NextUpdate value set

 - Validate that the ThisUpdate value is
   properly prior to our current time and
   if NextUpdate is set that, ThisUpdate is
   before NextUpdate.
 - If we don't have a value for NextUpdate just compare against ThisUpdate.

* Add ocsp_this_update_max_ttl support to cert auth

 - Allow configuring a maximum TTL of the OCSP response based on the
   ThisUpdate time like OpenSSL does
 - Add test to validate that we don't cache OCSP responses with no NextUpdate

* Add cl

* Add missing ` in docs

* Rename ocsp_this_update_max_ttl to ocsp_this_update_max_age

* Missed a few TTL references

* Fix error message
stevendpclark added a commit that referenced this pull request Mar 19, 2024
* Support OCSP responses without a NextUpdate value set

 - Validate that the ThisUpdate value is
   properly prior to our current time and
   if NextUpdate is set that, ThisUpdate is
   before NextUpdate.
 - If we don't have a value for NextUpdate just compare against ThisUpdate.

* Add ocsp_this_update_max_ttl support to cert auth

 - Allow configuring a maximum TTL of the OCSP response based on the
   ThisUpdate time like OpenSSL does
 - Add test to validate that we don't cache OCSP responses with no NextUpdate

* Add cl

* Add missing ` in docs

* Rename ocsp_this_update_max_ttl to ocsp_this_update_max_age

* Missed a few TTL references

* Fix error message

Co-authored-by: Steven Clark <[email protected]>
stevendpclark added a commit that referenced this pull request Mar 19, 2024
* Support OCSP responses without a NextUpdate value set

 - Validate that the ThisUpdate value is
   properly prior to our current time and
   if NextUpdate is set that, ThisUpdate is
   before NextUpdate.
 - If we don't have a value for NextUpdate just compare against ThisUpdate.

* Add ocsp_this_update_max_ttl support to cert auth

 - Allow configuring a maximum TTL of the OCSP response based on the
   ThisUpdate time like OpenSSL does
 - Add test to validate that we don't cache OCSP responses with no NextUpdate

* Add cl

* Add missing ` in docs

* Rename ocsp_this_update_max_ttl to ocsp_this_update_max_age

* Missed a few TTL references

* Fix error message

Co-authored-by: Steven Clark <[email protected]>
stevendpclark added a commit that referenced this pull request Mar 19, 2024
* Support OCSP responses without a NextUpdate value set

 - Validate that the ThisUpdate value is
   properly prior to our current time and
   if NextUpdate is set that, ThisUpdate is
   before NextUpdate.
 - If we don't have a value for NextUpdate just compare against ThisUpdate.

* Add ocsp_this_update_max_ttl support to cert auth

 - Allow configuring a maximum TTL of the OCSP response based on the
   ThisUpdate time like OpenSSL does
 - Add test to validate that we don't cache OCSP responses with no NextUpdate

* Add cl

* Add missing ` in docs

* Rename ocsp_this_update_max_ttl to ocsp_this_update_max_age

* Missed a few TTL references

* Fix error message

Co-authored-by: Steven Clark <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auth/cert Authentication - certificates hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants