Skip to content

curl using SChannel fails to validate TLS cert by IP SAN #15149

Description

@bagder

Discussed in #15139

Originally posted by elvinasp October 3, 2024
Hello,

I was making some networking labs and one of the examples was to connect via curl using various hosntname combinations and seeing how SNI behaves. When I connected to demo server IP address using windows build-in curl, it failed to validate certificate. Linux curl from WSL environment on same machine successfully connects to service via IP and validated TLS cert.

Has anything changed since v7 to v8?

Attaching certs generated with cfssl: certs.zip

Windows curl:
curl 8.7.1 (Windows) libcurl/8.7.1 Schannel zlib/1.3 WinIDN Release-Date: 2024-03-27 Protocols: dict file ftp ftps http https imap imaps ipfs ipns mqtt pop3 pop3s smb smbs smtp smtps telnet tftp Features: alt-svc AsynchDNS HSTS HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM SPNEGO SSL SSPI threadsafe Unicode UnixSockets

Output:

* schannel: added 2 certificate(s) from CA file './combined-ca.crt'
* schannel: connection hostname (192.168.4.2) did not match against certificate name (default.tp13.internal)
* schannel: connection hostname (192.168.4.2) did not match against certificate name (default)
* schannel: CertGetNameString() failed to match connection hostname (192.168.4.2) against server certificate names
* Closing connection
* schannel: shutting down SSL/TLS connection with 192.168.4.2 port 8443
curl: (60) schannel: CertGetNameString() failed to match connection hostname (192.168.4.2) against server certificate names

TLS certificate:

Properly lists all SANS:

            X509v3 Subject Alternative Name:
                DNS:default.tp13.internal, DNS:default, IP Address:192.168.4.3, IP Address:192.168.4.2, IP Address:10.20.3.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions