fix(wolfssl): when skip_common_name is set, skip OCSP status checking, but always do SNI (IDFGH-13834)#14684
fix(wolfssl): when skip_common_name is set, skip OCSP status checking, but always do SNI (IDFGH-13834)#14684frankencode wants to merge 1 commit into
Conversation
👋 Hello frankencode, we appreciate your contribution to this project! 📘 Please review the project's Contributions Guide for key guidelines on code, documentation, testing, and more. 🖊️ Please also make sure you have read and signed the Contributor License Agreement for this project. Click to see more instructions ...
Review and merge process you can expect ...
|
* When server certificate common name checking is disabled, OCSP status checks should also be disabled, as they cannot succeed when server's domain name is not matching its certificate's CN. (Match application programmers expectation.) * With wolfSSL SNI should always be enabled, because wolfSSL is known to fail to handle related TLS alerts correctly when SNI is missing.
|
Hi @frankencode Thanks for the PR. |
|
Sure, no problem. |
Description
This change includes two parts:
When server certificate common name checking is disabled, OCSP status checks should also be disabled, as they cannot succeed when server's domain name is not matching its certificate's CN. (Match application programmers expectation.)
With wolfSSL SNI should always be enabled, because wolfSSL is known to fail to handle related TLS alerts correctly when SNI is missing.
Testing
I've tested my changes with a wide coverage of different use cases performing TLS connections with the esp-http-client and esp-websocket-client libraries having wolfssl 5.7.2 (from /github.com/frankencode/esp-wolfssl) being configured as esp-tls backend and having TLS 1.3 + OCSP enabled. For a few tests I needed to disable server name checks on https connections, which I did with the esp-http-client's option skip_cert_common_name_check (which translates to skip_common_name on esp-tls layer) and this, as someone might have expected, now also disables OCSP status checks on the server's certificate. Without this change on my particular test servers I'm getting wolfSSL error -406 (invalid certificate status), which is to be expected when an OCSP status is stapled, but the server's certificate CN field is misconfigured and/or not matching its hostname. Having OCSP status checks also being disabled with the skip_common_name option meets my expectation (knowing well the security implications).
(mbedTLS still does not support OCSP stapling in any form, including a stapled status with TLS 1.3 and hence is not affected by this change.)