Maxim Dounin
October 22, 2013 08:10AM
Hello!

On Mon, Oct 21, 2013 at 10:40:43PM +0100, Rob Stradling wrote:

> On 19/10/13 11:14, Maxim Dounin wrote:
> <snip>
> >>I'll investigate more next week.
> >
> >The SSL_add1_chain_cert() function documentation says:
> >
> >: These functions were first added to OpenSSL 1.0.2.
> >
> >That is, they aren't yet available.
>
> True. FWIW, changing "SSL_CTX_add_extra_chain_cert" to
> "SSL_CTX_add1_chain_cert" in ngx_event_openssl.c and compiling
> against OpenSSL_1_0_2 does give the desired behaviour though.
>
> >>>For now, the one thing we could do is to let OpenSSL build certificate
> >>>chains from the trusted certificates store... In order to do that, all
> >>>we need to do is to load only the first certificate in the file (i.e.
> >>>don't load intermediate certificates) in case there are multiple
> >>>certificates defined. This way, OpenSSL will try to build the
> >>>certificate chain automatically (unfortunately, it will do that on the
> >>>fly for each connection, so it's a noticeable overhead).
> >>
> >>Yes, but (assuming "...from the trusted certificates store" would do
> >>syscalls and disk access for every connection) hasn't Maxim already
> >>said that that overhead would be unacceptable?
> >
> >This would be bad for sure, but the message you've referenced says
> >about CApath vs. CAfile. We have the ssl_trusted_certificate
> >directive which loads certs to the trusted certificates store.
>
> Ah, I see. It's just "CApath" that you want to avoid, and
> ssl_trusted_certificate is basically the same thing as "CAfile".
>
> To keep things simple for users, I think it would be best for Nginx
> to keep expecting to find the intermediate CA certs at the end of
> the ssl_certificate file (rather than require users to put them in
> the ssl_trusted_certificate file under certain circumstances). But
> I agree with using the "trusted certificates store" under the hood.
> The following approach seems to work:
>
> #if OPENSSL_VERSION_NUMBER >= 0x10002000L
> // OpenSSL 1.0.2 lets us do this properly
> Call SSL_CTX_add1_chain_cert(ssl->ctx, x509)
> #else
> If (number of ssl_certificate directives > 1)
> // Put this intermediate in the "trusted certificates store"
> Call X509_STORE_add_cert(ssl->ctx->cert_store, x509)
> Else
> // This is what Nginx does currently
> Call SSL_CTX_add_extra_chain_cert(ssl->ctx, x509)
> End If
> #endif

An unwanted side effect would be that this will allow client
certificate authentication to use certs from a server's
certificate chain. Probably not something we want to happen.

> (A side effect is that I'm seeing "OCSP_basic_verify:signer
> certificate not found" from the stapling code in both cases where I
> don't call SSL_CTX_add_extra_chain_cert() - another thing to look
> into!)

OCSP Stapling code uses certificate chain as available via
SSL_CTX_get_extra_chain_certs() to look for issuer cert, see
ngx_ssl_stapling_issuer(). Though certs from a trusted store
should be used too.

--
Maxim Dounin
http://nginx.org/en/donation.html

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] RSA+DSA+ECC bundles

Rob Stradling 1588 October 17, 2013 10:10AM

Re: [PATCH] RSA+DSA+ECC bundles

Maxim Dounin 583 October 17, 2013 11:20AM

Re: [PATCH] RSA+DSA+ECC bundles

Piotr Sikora 569 October 17, 2013 06:02PM

Re: [PATCH] RSA+DSA+ECC bundles

Rob Stradling 542 October 18, 2013 07:08PM

Re: [PATCH] RSA+DSA+ECC bundles

Maxim Dounin 648 October 19, 2013 06:16AM

Re: [PATCH] RSA+DSA+ECC bundles

Rob Stradling 606 October 21, 2013 05:42PM

Re: [PATCH] RSA+DSA+ECC bundles

Maxim Dounin 578 October 22, 2013 08:10AM

Re: [PATCH] RSA+DSA+ECC bundles

Rob Stradling 505 October 22, 2013 09:32AM

Re: [PATCH] RSA+DSA+ECC bundles

Maxim Dounin 600 October 22, 2013 08:26PM

Re: [PATCH] RSA+DSA+ECC bundles

W-Mark Kubacki 592 October 23, 2013 01:08PM

Re: [PATCH] RSA+DSA+ECC bundles

Rob Stradling 528 October 23, 2013 03:14PM

Re: [PATCH] RSA+DSA+ECC bundles

Piotr Sikora 569 October 23, 2013 05:50PM

Re: [PATCH] RSA+DSA+ECC bundles

Maxim Dounin 569 October 23, 2013 08:28PM

Re: [PATCH] RSA+DSA+ECC bundles

Rob Stradling 538 October 31, 2013 05:00PM

Re: [PATCH] RSA+DSA+ECC bundles

Rob Stradling 904 October 31, 2013 06:00PM

Re: [PATCH] RSA+DSA+ECC bundles

Maxim Dounin 553 November 01, 2013 06:48AM

Re: [PATCH] RSA+DSA+ECC bundles

Rob Stradling 528 November 01, 2013 08:10AM

Re: [PATCH] RSA+DSA+ECC bundles

Maxim Dounin 611 November 01, 2013 10:26AM

Re: [PATCH] RSA+DSA+ECC bundles

Rob Stradling 556 October 23, 2013 02:28PM

Re: [PATCH] RSA+DSA+ECC bundles

Piotr Sikora 580 October 23, 2013 05:56PM

Re: [PATCH] RSA+DSA+ECC bundles

Rob Stradling 667 October 24, 2013 08:10AM

Re: [PATCH] RSA+DSA+ECC bundles

Rob Stradling 574 October 18, 2013 06:52PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 164
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready