Opened 5 years ago

Closed 5 years ago

#810 closed defect (wontfix)

OCSP Stapling fails if first relevant server block lacks ssl_stapling directive

Reported by: jsha@… Owned by:
Priority: minor Milestone:
Component: nginx-core Version: 1.9.x
Keywords: Cc:
uname -a: Linux membrane 3.19.0-30-generic #33-Ubuntu SMP Mon Sep 21 20:58:04 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
ne 3.19.0-30-generic #33-Ubuntu SMP Mon Sep 21 20:58:04 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: $ ~/nginx/objs/nginx -V
nginx version: nginx/1.9.6
built by gcc 4.9.2 (Ubuntu 4.9.2-10ubuntu13)
built with OpenSSL 1.0.1f 6 Jan 2014
TLS SNI support enabled
configure arguments: --without-http_rewrite_module --with-http_ssl_module --with-debug
$ nginx -V
nginx version: nginx/1.6.2 (Ubuntu)
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now' --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 --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-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_spdy_module --with-http_sub_module --with-http_xslt_module --with-mail --with-mail_ssl_module

Description

Steps to reproduce:

Set up an nginx configuration with two server blocks listening on port 443, distinguished by server_name. Each server block should have ssl on and a valid certificate.

In the second server block, add ssl_stapling on. Start nginx with this config, then run:

openssl s_client -connect localhost:443 -tlsextdebug -status -servername <SERVERNAME2> < /dev/null

Expected result:

Output contains OCSP response information such as:

OCSP Response Data:

OCSP Response Status: successful (0x0)

Actual result:

Output contains no OCSP response information.

It appears that this problem depends only on the first server block. If some server blocks have ssl_stapling on and some don't, OCSP stapling will work so long as the first one has it.

Problem reproduces both on my system-installed Nginx 1.6.2 and an Nginx 1.9.6 built from source.

Attachments (1)

ssl-stapling-broken.conf (858 bytes ) - added by jsha@… 5 years ago.
An example config demonstrating the problem. Needs adjustment for appropriate certificates.

Download all attachments as: .zip

Change History (2)

by jsha@…, 5 years ago

Attachment: ssl-stapling-broken.conf added

An example config demonstrating the problem. Needs adjustment for appropriate certificates.

comment:1 by Maxim Dounin, 5 years ago

Resolution: wontfix
Status: newclosed

I think I finally tracked this (there were some complains previously in the mailing list, but without details). Thanks for the detailed nginx -V output with OpenSSL exact version number included. This seems to be an OpenSSL problem, silently fixed in OpenSSL 1.0.0m/1.0.1g/1.0.2. Details can be found here:

https://rt.openssl.org/Ticket/Display.html?id=3178
https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff;h=d0b039d4a3a19b106cc2cb938125b86aca4974aa

In short - old OpenSSL versions doesn't parse Certificate Status Request extension if no server status callback is configured in the default SSL context. As a result, OCSP stapling doesn't work when not configured in the default server{} block.

Fix is to update the OpenSSL library. An obvious workaround would be to configure OCSP stapling in the default server{} block.

Note: See TracTickets for help on using tickets.