]> git.kaiwu.me - nginx.git/commitdiff
SSL: fixed unexpected certificate requests (ticket #2008).
authorMaxim Dounin <mdounin@mdounin.ru>
Mon, 29 Jun 2020 14:15:51 +0000 (17:15 +0300)
committerMaxim Dounin <mdounin@mdounin.ru>
Mon, 29 Jun 2020 14:15:51 +0000 (17:15 +0300)
Using SSL_CTX_set_verify(SSL_VERIFY_PEER) implies that OpenSSL will
send a certificate request during an SSL handshake, leading to unexpected
certificate requests from browsers as long as there are any client
certificates installed.  Given that ngx_ssl_trusted_certificate()
is called unconditionally by the ngx_http_ssl_module, this affected
all HTTPS servers.  Broken by 699f6e55bbb4 (not released yet).

Fix is to set verify callback in the ngx_ssl_trusted_certificate() function
without changing the verify mode.

src/event/ngx_event_openssl.c

index c1d5d6a43b35dc8f9856380b1c2d20b3a05a4fce..f589b9812ff5490b1bc15bb27d53b69e22e88cdf 100644 (file)
@@ -920,7 +920,8 @@ ngx_int_t
 ngx_ssl_trusted_certificate(ngx_conf_t *cf, ngx_ssl_t *ssl, ngx_str_t *cert,
     ngx_int_t depth)
 {
-    SSL_CTX_set_verify(ssl->ctx, SSL_VERIFY_PEER, ngx_ssl_verify_callback);
+    SSL_CTX_set_verify(ssl->ctx, SSL_CTX_get_verify_mode(ssl->ctx),
+                       ngx_ssl_verify_callback);
 
     SSL_CTX_set_verify_depth(ssl->ctx, depth);