Opened 6 years ago

Closed 6 years ago

#1699 closed defect (invalid)

encoding error ssl_stapling_file

Reported by: n8v8R@… Owned by:
Priority: minor Milestone:
Component: nginx-core Version: 1.14.x
Keywords: Cc:
uname -a: Linux 4.4.167-4a7a81f8db0ad743e54c68e1845c60b6-1 #1 SMP Tue Dec 18 11:40:26 CET 2018 armv7l GNU/Linux
nginx -V: nginx version: nginx/1.14.2
built with OpenSSL 1.1.1a 20 Nov 2018
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --sbin-path=/usr/bin/nginx --pid-path=/run/nginx.pid --lock-path=/run/lock/nginx.lock --user=http --group=http --http-log-path=/var/log/nginx/access.log --error-log-path=stderr --http-client-body-temp-path=/var/lib/nginx/client-body --http-proxy-temp-path=/var/lib/nginx/proxy --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-cc-opt='-march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16 -O2 -pipe -fstack-protector-strong -fno-plt -fPIC -D_FORTIFY_SOURCE=2' --with-ld-opt=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now --with-compat --with-debug --with-file-aio --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_degradation_module --with-http_flv_module --with-http_geoip_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-pcre-jit --with-stream --with-stream_geoip_module --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-threads

Description

ssl_stapling_file foo.bar.der;
ssl_stapling  on;

nginx -t then produces:

[emerg] 24249#24249: d2i_OCSP_RESPONSE_bio("foo.bar.der") failed (SSL: error:0D0680A8:asn1 encoding routines:asn1_check_tlen:wrong tag error:0D06C03A:asn1 encoding routines:asn1_d2i_ex_primitive:nested asn1 error error:0D08303A:asn1 encoding routines:asn1_template_noexp_d2i:nested asn1 error:Field=responseStatus, Type=OCSP_RESPONSE)

WIth:

 # ssl_stapling  on;

there is no such error?!

openssl x509 -noout -text -inform der -in foo.bar.der

prints the certificate just fine. Having switched between utf8 and ascii did not make a difference either, same outcome.

openssl asn1parse -inform DER -in foo.bar.der

is also printing the values just fine.

It happens only there and other certificates are not affected.

The ocsp certificate is generated as follows:

openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:P-384 -out foo.bar.key.pem -aes-256-cbc
openssl req -config foo_bar_ca.cnf -key foo.bar.key.pem -new -out foo.bar.csr.pem
openssl ca -config foo_bar_ca.cnf -extensions ocsp -days 365 -notext -in foo.bar.csr.pem -out foo.bar.cert.pem
openssl x509 -outform DER -in foo.bar.cert.pem -out foo.bar.cert.der

The -extensions ocsp part of foo_bar_ca.cnf

basicConstraints = CA:FALSE
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid, issuer
keyUsage = critical, digitalSignature
extendedKeyUsage = critical, OCSPSigning

Change History (1)

comment:1 by Maxim Dounin, 6 years ago

Resolution: invalid
Status: newclosed

The "ssl_stapling_file" directive needs an OCSP response obtained from your certificate authority, not a certificate. As you are trying to put a certificate instead, parsing expectedly fails.

Note: See TracTickets for help on using tickets.