[PATCH 1 of 2] SSL: logging level of all "SSL alert number N" errors
Maxim Dounin
mdounin at mdounin.ru
Fri May 3 00:11:06 UTC 2024
# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1714695001 -10800
# Fri May 03 03:10:01 2024 +0300
# Node ID eded0170b9606af830a23da4f26e48bf6fe5c318
# Parent 388a801e9bb9ab0a44713c510d1337a9432fe2b7
SSL: logging level of all "SSL alert number N" errors.
Errors about alerts received from peers are generated by OpenSSL by adding
peer-provided alert description (from 0 to 255) to SSL_AD_REASON_OFFSET.
All such errors, including ones for unknown alerts, are now logged at the
"info" level, as these can be caused by a misbehaving client.
diff --git a/src/event/ngx_event_openssl.c b/src/event/ngx_event_openssl.c
--- a/src/event/ngx_event_openssl.c
+++ b/src/event/ngx_event_openssl.c
@@ -3590,32 +3590,8 @@ ngx_ssl_connection_error(ngx_connection_
#ifdef SSL_R_BAD_RECORD_TYPE
|| n == SSL_R_BAD_RECORD_TYPE /* 443 */
#endif
- || n == 1000 /* SSL_R_SSLV3_ALERT_CLOSE_NOTIFY */
-#ifdef SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE
- || n == SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE /* 1010 */
- || n == SSL_R_SSLV3_ALERT_BAD_RECORD_MAC /* 1020 */
- || n == SSL_R_TLSV1_ALERT_DECRYPTION_FAILED /* 1021 */
- || n == SSL_R_TLSV1_ALERT_RECORD_OVERFLOW /* 1022 */
- || n == SSL_R_SSLV3_ALERT_DECOMPRESSION_FAILURE /* 1030 */
- || n == SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE /* 1040 */
- || n == SSL_R_SSLV3_ALERT_NO_CERTIFICATE /* 1041 */
- || n == SSL_R_SSLV3_ALERT_BAD_CERTIFICATE /* 1042 */
- || n == SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE /* 1043 */
- || n == SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED /* 1044 */
- || n == SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED /* 1045 */
- || n == SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN /* 1046 */
- || n == SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER /* 1047 */
- || n == SSL_R_TLSV1_ALERT_UNKNOWN_CA /* 1048 */
- || n == SSL_R_TLSV1_ALERT_ACCESS_DENIED /* 1049 */
- || n == SSL_R_TLSV1_ALERT_DECODE_ERROR /* 1050 */
- || n == SSL_R_TLSV1_ALERT_DECRYPT_ERROR /* 1051 */
- || n == SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION /* 1060 */
- || n == SSL_R_TLSV1_ALERT_PROTOCOL_VERSION /* 1070 */
- || n == SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY /* 1071 */
- || n == SSL_R_TLSV1_ALERT_INTERNAL_ERROR /* 1080 */
- || n == SSL_R_TLSV1_ALERT_USER_CANCELLED /* 1090 */
- || n == SSL_R_TLSV1_ALERT_NO_RENEGOTIATION /* 1100 */
-#endif
+ || (n >= SSL_AD_REASON_OFFSET /* 1000 */
+ && n <= SSL_AD_REASON_OFFSET + 255)
)
{
switch (c->log_error) {
More information about the nginx-devel
mailing list