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

Extracting 'nextUpdate' from OCSP stapling responses #75

Closed
alubbe opened this issue Dec 8, 2016 · 5 comments · Fixed by #296
Closed

Extracting 'nextUpdate' from OCSP stapling responses #75

alubbe opened this issue Dec 8, 2016 · 5 comments · Fixed by #296

Comments

@alubbe
Copy link
Contributor

alubbe commented Dec 8, 2016

We have been playing with ngx.ocsp. Ideally, we'd like to cache the CA's responses. Is there a way to find for how long the responses are valid, similar to /~https://github.com/indutny/ocsp/blob/master/lib/ocsp/cache.js#L81-L117?

@alubbe alubbe changed the title Caching OCSP stapling responses Extracting 'nextUpdate' from OCSP stapling responses Mar 21, 2017
@alubbe
Copy link
Contributor Author

alubbe commented Mar 21, 2017

I've updated the title to better reflect our question.
We are working with certificates from letsencrypt and their ocsp responses expire at fixed points in time, irrespective of when the ocsp request was sent. In order to refresh the response, it is vital to know when it expires. Is there any way to do that currently?

@alubbe
Copy link
Contributor Author

alubbe commented Mar 22, 2017

pinging @agentzh
Currently, we are just polling the ocsp endpoint. Because of this, there are intervals where we are stapling an outdated response. It'd be great to do this more efficiently.

@alubbe
Copy link
Contributor Author

alubbe commented Apr 7, 2017

I'm deducing from the lack of responses that there is currently no way of doing this.
I had a look at the openssl and nginx source code and found a) a function that can extract nextUpdate (openssl) and b) a function to convert that value to time_t (nginx).

@agentzh I'd love some feedback on whether a PR on adding a new method to ocsp would be welcome. There are two different method that could solve our issue:

  1. get_nextupdate: Would return the nextupdate timestamp as seconds since the unix epoch. Calculating its validity would then happen in lua-land. This may have timezone/clock delay issues.
  2. get_nextupdate_validity: Would return the difference between nextupdate and C-land t_now. This way, lua-land can immediately set a time based on this, or, for negative values, request a new ocsp response.

@ElvinEfendi
Copy link
Contributor

FWIW we are adding OCSP stapling feature to /~https://github.com/kubernetes/ingress-nginx and having thisUpdate and nextUpdate attributes exposed on the Lua land would be really useful for deciding cache validity.

@ElvinEfendi
Copy link
Contributor

I took an alternative stab at this: #296

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants