Previously we written in details on How to Enable OCSP Stapling Nginx. Here is How to Fix Nginx OCSP ERROR – OCSP Response Expired After Enabling OCSP Stapling on Nginx. Error is Due to Certain Criterion of RFC. This is not quite uncommon error.
Why OCSP ERROR : OCSP Response Expired Appears?
It is common to get this error in Opera Browser, where the error code is Error 1066. It shows up as Secure connection: fatal error (1066). Unable to verify the website’s identity (OCSP error). The response from the online certificate validation (OCSP) server was too old.. When you are just user, the fix is easy as Opera user – type opera:config
on your Opera Browser’s address bar, go to Security Preferences, Disable “OCSP Validate Certificates”. It is clearly not for the server administrators but as user or client. Opera is powerful browser, so is Firefox. It can be cross checked with SSL Lab’s test, where the error will show up as :
1 | OCSP ERROR: OCSP response expired on Thu Aug 08 02:45:09 PDT 2016 |
The RFC needs revision, OCSP had an old version. It is due to the case known as “OCSP Must-Staple”. The concept of “Must-Staple” was implemented to allow the web browsers to reliably implement a fail hard policy. But actually it never happened out of other bugs, problems with other protocols etc. There was an explosion of certificate revocation in pre-heartbleed era. There are valid reasons of it (which is related to security and you can web search, it is off topic here). With OCSP, web browsers no longer required to obtain and cache huge certificate revocation lists. The OCSP protocol allows anyone relying upon the validity of any apparently-valid certificate on-the-fly. RFC 6066 (June, 2011) the TLS protocol was extended to allow a web browser to request and a web server to supply this OCSP information in its initial connection handshake. The common problems with current method is Bandwidth & OCSP server load and continuous try by the Browsers to both make the Performance better but also not trade on security.
---
In short, OCSP stapling the TLS web server (Nginx in our case) periodically asks the CA’s OCSP server for the revocation status of the certificate it is serving, and the CA server replies with a signed and timestamped OCSP response. This response is saved as cache in nginx and it is sent along with the certificate to the clients when they connect. The client uses the CA signature and the timestamp to verify the validity of the response. OCSP stapling is designed to reduce the cost of an OCSP validation. However, OCSP stapling supported only one OCSP response at a time, this limitation has been addressed by Multiple Certificate Status Request Extension, specified in RFC 6961.
So – OCSP ERROR : OCSP Response Expired is not out of your any mistake, it is out of old background, HearBleed etc. Browsers are actually towards perfect. With this knowledge, you can read here if you are interested about the thing –
1 | https://wiki.mozilla.org/CA:ImprovingRevocation |
How to Fix This OCSP ERROR : OCSP Response Expired on Nginx?
OCSP Response Expired is not out of your any mistake, very much truth. But you want to get rid of this error. It is exactly like why we almost never use too much tight cipher. It is not abnormal to get erroneously blacklisted by some automatic checking systems.
In our previous guide on How to Enable OCSP Stapling Nginx, we supplied the example configuration so that OCSP Must-Staple happens, validating the OCSP response. It was too tight. We have no made it complex by mentioning –
1 | http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_stapling |
Until OCSP Must-Staple happens, validating the OCSP response not of huge value and can be disabled to reduce configuration overhead. The client will validate the OCSP response anyway. Even if an attacker induced the server to staple a bogus response, the client would ignore. It will be like no stapling. So the answer how to fix this OCSP ERROR : OCSP Response Expired on Nginx is just making the ssl_stapling_verify
directive off from on :
1 2 | ssl_stapling on; ssl_stapling_verify off; |
Followed by checking config with nginx -t
and restarting Nginx. You’ll not get error anymore if you test on SSL Labs or Opera browser.
Additionally, you can increase these directive’s values like this example for better performance –
1 2 3 4 5 6 7 | ... resolver 8.8.8.8 8.8.4.4 valid=300s; resolver_timeout 30s; ... ssl_session_cache builtin:1000 shared:SSL:20m; ssl_session_timeout 4h; ... |
No! I Do Not Want Your Quick Fix. I Will Keep ssl_stapling_verify on And Use Complicated Way
Server is yours. We use OFF
like written above. It may happen that you want to keep ssl_stapling_verify on
despite it can give such error in future which none ever probably could troubleshoot. We have not talked about the ssl_stapling_responder
directive to avoid complexity. This directive overrides the URL of the OCSP responder specified in the Authority Information Access (RFC 5280, section 4.2.2.1) certificate extension. For GeoTrust SSL/TLS certificate, information to retrieve the URL is here :
1 | https://knowledge.geotrust.com/support/knowledge-base/index?page=content&actp=CROSSLINK&id=HOWTO111090 |
In very short, you need to run this command :
1 | OLDIFS=$IFS; IFS=':' certificates=$(openssl s_client -connect google.com:443 -showcerts -tlsextdebug -tls1 2>&1 </dev/null | sed -n '/-----BEGIN/,/-----END/ {/-----BEGIN/ s/^/:/; p}'); for certificate in ${certificates#:}; do echo $certificate | openssl x509 -noout -ocsp_uri; done; IFS=$OLDIFS |
We received http://g.symcd.com
as one URL for GeoTrust.
In such case, you have to use these three :
1 2 3 | ssl_stapling on; ssl_stapling_verify on; ssl_stapling_responder http://your-ocsp.your-ca.com/; |
Followed by checking config with nginx -t
and restarting Nginx.