1
  • Host: Ubuntu 20.04.2 (5.4.0-67-generic) x64
  • Server: NGINX 1.18.0 (Ubuntu)
  • CA: Let's Encrypt

Having a really hard time getting OCSP to work consistently. Any help would be appreciated. Thanks in advance.


On fresh boot, clear of caches (DNS, browser), visiting my configured domain from outside the network I will get no OCSP response.

Here is an OpenSSL test:

PS C:\> openssl s_client -connect cdn.example.com:443 -status

CONNECTED(000001A4)
depth=1 C = US, O = Let's Encrypt, CN = R3
verify error:num=20:unable to get local issuer certificate
verify return:1
depth=0 CN = cdn.example.com
verify return:1
OCSP response: no response sent
---
Certificate chain
 0 s:CN = cdn.example.com
   i:C = US, O = Let's Encrypt, CN = R3
 1 s:C = US, O = Let's Encrypt, CN = R3
   i:O = Digital Signature Trust Co., CN = DST Root CA X3
---
Server certificate
-----BEGIN CERTIFICATE-----
<long string>
-----END CERTIFICATE-----
subject=CN = cdn.example.com

issuer=C = US, O = Let's Encrypt, CN = R3

---
No client certificate CA names sent
Peer signing digest: SHA256
Peer signature type: RSA-PSS
Server Temp Key: X25519, 253 bits
---
SSL handshake has read 2963 bytes and written 424 bytes
Verification error: unable to get local issuer certificate
---
New, TLSv1.2, Cipher is ECDHE-RSA-AES256-GCM-SHA384
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
    Protocol  : TLSv1.2
    Cipher    : ECDHE-RSA-AES256-GCM-SHA384
    Session-ID: <long string>
    Session-ID-ctx:
    Master-Key: <long string>
    PSK identity: None
    PSK identity hint: None
    SRP username: None
    Start Time: 1616045447
    Timeout   : 7200 (sec)
    Verify return code: 20 (unable to get local issuer certificate)
    Extended master secret: yes
---

This means on initial connect Firefox throws a security warning.

MOZILLA_PKIX_ERROR_REQUIRED_TLS_FEATURE_MISSING

I looked up this warning and Firefox will stop the connection if the server did not respond with stapling if required by the server. You can click [Try Again] and hope it will go through. It's a 30% rate. The behavior and warning is something I do not want. For one it can actually prevent access to the site. Then it poses a security issue itself. Users will see this warning and get stale to it if [Try Again] works for them. Thus future security problems on any site, they may disregard a warning and unknowingly become a victim.

Here is my server block settings for SSL:

ssl_certificate "/etc/letsencrypt/live/cdn.example.com/fullchain.pem";
ssl_certificate_key "/etc/letsencrypt/live/cdn.example.com/privkey.pem";
ssl_session_timeout 1d;
ssl_session_cache shared:MozSSL:10m;
ssl_session_tickets off;
ssl_dhparam "/etc/letsencrypt/live/dhparam.pem";
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS";
ssl_prefer_server_ciphers on;
add_header Strict-Transport-Security "max-age=31536000" always;
ssl_stapling on;
ssl_trusted_certificate "/etc/letsencrypt/live/cdn.example.com/chain.pem";

Per the README file after certbot generation:

[cert name]/chain.pem : used for OCSP stapling in Nginx >=1.3.7.

Multiple documentations I read from all over the place on how to use OCSP indicates I have set this up correctly. I collected some certificates from LE via their support page. They are installed to the system. The default certificates tell me I have 129. Once I add mine, I have 133.

root@vmx:/# ls -lsha /usr/local/share/ca-certificates

example.crt -> /etc/letsencrypt/live/example.com/chain.pem
isrg-root-ocsp-x1.crt -> /etc/letsencrypt/live/isrg-root-ocsp-x1.pem
isrgrootx1.crt -> /etc/letsencrypt/live/isrgrootx1.pem
lets-encrypt-r3.crt -> /etc/letsencrypt/live/lets-encrypt-r3.pem

The server should be sending the stapled response on first connect. Moreover, once you ignore the Firefox warning and the page does load, you can run an openssl command to get:

PS C:\> openssl s_client -connect cdn.example.com:443 -status

CONNECTED(000001A0)
depth=1 C = US, O = Let's Encrypt, CN = R3
verify error:num=20:unable to get local issuer certificate
verify return:1
depth=0 CN = cdn.example.com
verify return:1
OCSP response:
======================================
OCSP Response Data:
    OCSP Response Status: successful (0x0)
    Response Type: Basic OCSP Response
    Version: 1 (0x0)
    Responder Id: C = US, O = Let's Encrypt, CN = R3
    Produced At: Mar 16 05:36:00 2021 GMT
    Responses:
    Certificate ID:
      Hash Algorithm: sha1
      Issuer Name Hash: <long string>
      Issuer Key Hash: <long string>
      Serial Number: <long string>
    Cert Status: good
    This Update: Mar 16 05:00:00 2021 GMT
    Next Update: Mar 23 05:00:00 2021 GMT

    Signature Algorithm: sha256WithRSAEncryption
        <long string>
======================================
---
Certificate chain
 0 s:CN = cdn.example.com
   i:C = US, O = Let's Encrypt, CN = R3
 1 s:C = US, O = Let's Encrypt, CN = R3
   i:O = Digital Signature Trust Co., CN = DST Root CA X3
---
Server certificate
-----BEGIN CERTIFICATE-----
<long string>
-----END CERTIFICATE-----
subject=CN = cdn.example.com

issuer=C = US, O = Let's Encrypt, CN = R3

---
No client certificate CA names sent
Peer signing digest: SHA256
Peer signature type: RSA-PSS
Server Temp Key: X25519, 253 bits
---
SSL handshake has read 3483 bytes and written 424 bytes
Verification error: unable to get local issuer certificate
---
New, TLSv1.2, Cipher is ECDHE-RSA-AES256-GCM-SHA384
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
    Protocol  : TLSv1.2
    Cipher    : ECDHE-RSA-AES256-GCM-SHA384
    Session-ID: <long string>
    Session-ID-ctx:
    Master-Key: <long string>
    PSK identity: None
    PSK identity hint: None
    SRP username: None
    Start Time: 1616045922
    Timeout   : 7200 (sec)
    Verify return code: 20 (unable to get local issuer certificate)
    Extended master secret: yes
---

It magically works now. All future requests are good. But the moment you clear cache, the warning comes back.

When looking over logs, I see this in the /var/log/nginx/error.log file:

"ssl_stapling" ignored, host not found in OCSP responder "r3.o.lencr.org" in the certificate "/etc/letsencrypt/live/cdn.example.com/fullchain.pem"

A fresh run at https://entrust.ssllabs.com/ reports the following:

OCSP Must Staple            Supported

Again, more documentation states this should say:

OCSP Must Staple            Yes

I am conflicted on whether I am in fact doing something wrong, or there is an issue out of my control. I want this work reliably for two reasons as noted here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.