﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	uname	nginx_version
2116	OCSP verification fails if response is signed by a designated authority	Yan Foto		"Enabling stapled OCSP by setting `ssl_stapling` and `ssl_stapling_verify` works flawlessly if the certificate and its OCSP response are **both** signed by the same authority, i.e. identified by the same certificate. This is how Let's Encrypt issues and signs OCSP certs, e.g. both by `issuer=C = US, O = Let's Encrypt, CN = R3`.

If, however, the OCSP responce is signed by a designated authority which is not the same as the issuing CA (and is not included in chain passed to `ssl_certificate`), nginx fails to verify the OCSP response:


{{{
OCSP_basic_verify() failed (SSL: error:27069065:OCSP routines:OCSP_basic_verify:certificate verify error:Verify error:unable to get local issuer certificate) while requesting certificate status, responder: ocsp.buypass.com, peer: 23.55.161.81:80, certificate: ""/etc/letsencrypt/live/example.com/fullchain.pem""
}}}

Nonetheless, RFC 2560 (see https://tools.ietf.org/html/rfc2560#section-4.2.2.2) considers such situation as valid and thus should be properly handled by nginx.

----

I have tested this with DV certificates generated and got signed using `certbot`, one from Let's Encrypt (works) and another from buyssl (fails). Certbot generates three files:

* `chain.pem`:     intermediate CA certs
* `fullchain.pem`: leaf + intermediate CA certs
* `privkey.pem`:   private key

For Let's Encrypt certs I only need the following lines in my config:

{{{
    ssl_stapling on;
    ssl_stapling_verify on;
    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot
}}}

For buyssl certs I need to add an extra line:

{{{
ssl_trusted_certificate /etc/letsencrypt/live/example.com/ocsp-chain.pem;
}}}

where `ocsp-chain.pem` is `fullchain.pem` + the root certificate of buyssl which is already included in my `/etc/ssl/certs`. In other words I have to pass the whole trust chain for nginx to be able to verify OCSP."	defect	closed	minor		nginx-core	1.14.x	invalid	ocsp,openssl		Linux 4.19.0-13-amd64 #1 SMP Debian 4.19.160-2 (2020-11-28) x86_64 GNU/Linux	"nginx version: nginx/1.14.2
built with OpenSSL 1.1.1d  10 Sep 2019
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fdebug-prefix-map=/build/nginx-Cjs4TR/nginx-1.14.2=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -fPIC' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_geoip_module=dynamic --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_sub_module --with-http_xslt_module=dynamic --with-stream=dynamic --with-stream_ssl_module --with-stream_ssl_preread_module --with-mail=dynamic --with-mail_ssl_module --add-dynamic-module=/build/nginx-Cjs4TR/nginx-1.14.2/debian/modules/http-auth-pam --add-dynamic-module=/build/nginx-Cjs4TR/nginx-1.14.2/debian/modules/http-dav-ext --add-dynamic-module=/build/nginx-Cjs4TR/nginx-1.14.2/debian/modules/http-echo --add-dynamic-module=/build/nginx-Cjs4TR/nginx-1.14.2/debian/modules/http-upstream-fair --add-dynamic-module=/build/nginx-Cjs4TR/nginx-1.14.2/debian/modules/http-subs-filter"
