Roman Arutyunyan
March 13, 2023 09:00AM
details: https://hg.nginx.org/nginx/rev/69c7df4fe5d3
branches:
changeset: 8143:69c7df4fe5d3
user: Maxim Dounin <mdounin@mdounin.ru>
date: Wed Mar 08 22:21:53 2023 +0300
description:
SSL: switched to detect log level based on the last error.

In some cases there might be multiple errors in the OpenSSL error queue,
notably when a libcrypto call fails, and then the SSL layer generates
an error itself. For example, the following errors were observed
with OpenSSL 3.0.8 with TLSv1.3 enabled:

SSL_do_handshake() failed (SSL: error:02800066:Diffie-Hellman routines::invalid public key error:0A000132:SSL routines::bad ecpoint)
SSL_do_handshake() failed (SSL: error:08000066:elliptic curve routines::invalid encoding error:0A000132:SSL routines::bad ecpoint)
SSL_do_handshake() failed (SSL: error:0800006B:elliptic curve routines::point is not on curve error:0A000132:SSL routines::bad ecpoint)

In such cases it seems to be better to determine logging level based on
the last error in the error queue (the one added by the SSL layer,
SSL_R_BAD_ECPOINT in all of the above example example errors). To do so,
the ngx_ssl_connection_error() function was changed to use
ERR_peek_last_error().

diffstat:

src/event/ngx_event_openssl.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r a10210a45c8b -r 69c7df4fe5d3 src/event/ngx_event_openssl.c
--- a/src/event/ngx_event_openssl.c Thu Feb 23 08:09:50 2023 +0900
+++ b/src/event/ngx_event_openssl.c Wed Mar 08 22:21:53 2023 +0300
@@ -3389,7 +3389,7 @@ ngx_ssl_connection_error(ngx_connection_

} else if (sslerr == SSL_ERROR_SSL) {

- n = ERR_GET_REASON(ERR_peek_error());
+ n = ERR_GET_REASON(ERR_peek_last_error());

/* handshake failures */
if (n == SSL_R_BAD_CHANGE_CIPHER_SPEC /* 103 */
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] SSL: switched to detect log level based on the last error.

Roman Arutyunyan 470 March 13, 2023 09:00AM



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

Online Users

Guests: 286
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