mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-10-26 12:24:46 +00:00
Match a host name against subjectAltName only
OpenSSL 4.1 no longer falls back to the subject Common Name when it checks a host name (RFC 9525), so SSLClientServerTest.TlsVerifyHostname began failing in the Windows CI job that installs the newest OpenSSL 4.x. Make every backend agree instead of following whichever OpenSSL is installed. OpenSSL passes X509_CHECK_FLAG_NEVER_CHECK_SUBJECT to both the handshake check and verify_hostname(), and Mbed TLS and wolfSSL drop their own CN fallback. A certificate that names its host only in the CN is now rejected on all backends, as it already was on BoringSSL.
This commit is contained in:
1 parent
7d349cbeed
commit
d23d1b6029
6 files changed
+79
-45
No files matched your search
@@ -153,6 +153,14 @@ if(HTTPLIB_IS_USING_OPENSSL)
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMAND_ERROR_IS_FATAL ANY
|
||||
)
|
||||
# cert_dns_cn.pem: CN is the DNS name the tests connect to, with NO
|
||||
# subjectAltName. A host is named by a SAN only (RFC 9525),
|
||||
# so verifying it against this cert must fail.
|
||||
execute_process(
|
||||
COMMAND ${OPENSSL_COMMAND} req -x509 -key key.pem -sha256 -days 3650 -nodes -subj /CN=localhost -out cert_dns_cn.pem
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMAND_ERROR_IS_FATAL ANY
|
||||
)
|
||||
# cert_wildcard_san.pem: a leftmost wildcard next to one that is not
|
||||
# leftmost. "*.leftmost.example.test" matches a single
|
||||
# label; the wildcard in "www.*.example.test" must not be
|
||||
|
||||
Reference in new issue
Block a user