L'ambiente server: Windows Server 2012 R2 + IIS8.5.
Stiamo testando tre certificati autofirmati creati da: C # (System.Security.Cryptography.X509Certificates), makecert + pvk2pfx e openssl rispettivamente.
Accade una cosa strana:
Quando IIS esegue il binding dei certificati creati da makecert o openssl, la connessione dal browser client funziona correttamente.
Quando IIS associa certificati creati da C #, la connessione viene reimpostata dal server immediatamente dopo aver ricevuto Client Hello dal client. Traffico catturato da Wireshark elencato come di seguito:
1 0.000000 10.33.94.249 10.33.92.25 TCP 66 8740->7443 [SYN] Seq=0 Win=8192 Len=0 MSS=1460 WS=256 SACK_PERM=1
2 0.015387 10.33.92.25 10.33.94.249 TCP 66 7443->8740 [SYN, ACK] Seq=0 Ack=1 Win=8192 Len=0 MSS=1460 WS=256 SACK_PERM=1
3 0.015663 10.33.94.249 10.33.92.25 TCP 60 8740->7443 [ACK] Seq=1 Ack=1 Win=65536 Len=0
4 0.015845 10.33.94.249 10.33.92.25 SSL 271 **Client Hello**
5 0.017408 10.33.92.25 10.33.94.249 TCP 54 7443->8740 **[RST, ACK]** Seq=1 Ack=218 Win=0 Len=0
SSL Record Layer: Handshake Protocol: Client Hello
Content Type: Handshake (22)
Version: TLS 1.0
Handshake Protocol: Client Hello
Handshake Type: Client Hello (1)
Version: TLS 1.2
Ho confermato che i tre certificati creati in modi diversi hanno le stesse estensioni (Utilizzo avanzato delle chiavi, Utilizzo chiave, Identificatore chiave soggetto) e tutti hanno le chiavi private.
---- Aggiornamento 1 ----
Per suggerimento, ho caricato due certificati con chiave privata inclusa.
Il cattivo creato da C #: link
Il buono creato da openssl: link
La password per la chiave è 1.
---- Aggiornamento 2 ----
Il registro di IIS mostra solo una connessione riuscita con il cert buono. La connessione fallita con il certificato errato non viene mostrata nel log.
Qualche ulteriore idea di eseguire il debug?
---- Aggiornamento 3 ----
Aggiungi i dettagli di Client Hello
No. Time Source Destination Protocol Length Info
4 0.015845000 10.33.94.249 10.33.92.25 SSL 271 Client Hello
Frame 4: 271 bytes on wire (2168 bits), 271 bytes captured (2168 bits) on interface 0
Ethernet II, Src: Dell_9c:c4:57 (34:17:eb:9c:c4:57), Dst: Vmware_62:c8:76 (00:0c:29:62:c8:76)
Internet Protocol Version 4, Src: 10.33.94.249 (10.33.94.249), Dst: 10.33.92.25 (10.33.92.25)
Transmission Control Protocol, Src Port: 8740 (8740), Dst Port: 7443 (7443), Seq: 1, Ack: 1, Len: 217
Secure Sockets Layer
SSL Record Layer: Handshake Protocol: Client Hello
Content Type: Handshake (22)
Version: TLS 1.0 (0x0301)
Length: 212
Handshake Protocol: Client Hello
Handshake Type: Client Hello (1)
Length: 208
Version: TLS 1.2 (0x0303)
Random
Session ID Length: 0
Cipher Suites Length: 22
Cipher Suites (11 suites)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 (0xc02b)
Cipher Suite: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (0xc02f)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA (0xc00a)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA (0xc009)
Cipher Suite: TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA (0xc013)
Cipher Suite: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (0xc014)
Cipher Suite: TLS_DHE_RSA_WITH_AES_128_CBC_SHA (0x0033)
Cipher Suite: TLS_DHE_RSA_WITH_AES_256_CBC_SHA (0x0039)
Cipher Suite: TLS_RSA_WITH_AES_128_CBC_SHA (0x002f)
Cipher Suite: TLS_RSA_WITH_AES_256_CBC_SHA (0x0035)
Cipher Suite: TLS_RSA_WITH_3DES_EDE_CBC_SHA (0x000a)
Compression Methods Length: 1
Compression Methods (1 method)
Compression Method: null (0)
Extensions Length: 145
Extension: server_name
Type: server_name (0x0000)
Length: 34
Server Name Indication extension
Extension: renegotiation_info
Type: renegotiation_info (0xff01)
Length: 1
Renegotiation Info extension
Extension: elliptic_curves
Type: elliptic_curves (0x000a)
Length: 8
Elliptic Curves Length: 6
Elliptic curves (3 curves)
Extension: ec_point_formats
Type: ec_point_formats (0x000b)
Length: 2
EC point formats Length: 1
Elliptic curves point formats (1)
Extension: SessionTicket TLS
Type: SessionTicket TLS (0x0023)
Length: 0
Data (0 bytes)
Extension: next_protocol_negotiation
Type: next_protocol_negotiation (0x3374)
Length: 0
Extension: Application Layer Protocol Negotiation
Type: Application Layer Protocol Negotiation (0x0010)
Length: 41
ALPN Extension Length: 39
ALPN Protocol
Extension: status_request
Type: status_request (0x0005)
Length: 5
Certificate Status Type: OCSP (1)
Responder ID list Length: 0
Request Extensions Length: 0
Extension: signature_algorithms
Type: signature_algorithms (0x000d)
Length: 18
Signature Hash Algorithms Length: 16
Signature Hash Algorithms (8 algorithms)
Signature Hash Algorithm: 0x0401
Signature Hash Algorithm Hash: SHA256 (4)
Signature Hash Algorithm Signature: RSA (1)
Signature Hash Algorithm: 0x0501
Signature Hash Algorithm Hash: SHA384 (5)
Signature Hash Algorithm Signature: RSA (1)
Signature Hash Algorithm: 0x0201
Signature Hash Algorithm Hash: SHA1 (2)
Signature Hash Algorithm Signature: RSA (1)
Signature Hash Algorithm: 0x0403
Signature Hash Algorithm Hash: SHA256 (4)
Signature Hash Algorithm Signature: ECDSA (3)
Signature Hash Algorithm: 0x0503
Signature Hash Algorithm Hash: SHA384 (5)
Signature Hash Algorithm Signature: ECDSA (3)
Signature Hash Algorithm: 0x0203
Signature Hash Algorithm Hash: SHA1 (2)
Signature Hash Algorithm Signature: ECDSA (3)
Signature Hash Algorithm: 0x0402
Signature Hash Algorithm Hash: SHA256 (4)
Signature Hash Algorithm Signature: DSA (2)
Signature Hash Algorithm: 0x0202
Signature Hash Algorithm Hash: SHA1 (2)
Signature Hash Algorithm Signature: DSA (2)
Dopo aver esaminato questo e i certificati ho trovato un punto sospetto: l'algoritmo della firma.
C # cert:
Algoritmo di firma: sha512RSA
Algoritmo di hash delle firme: sha512
Algoritmo Thumbprint: sha1
openssl cert:
Algoritmo di firma: sha256RSA
Algoritmo di hash delle firme: sha256
Algoritmo Thumbprint: sha1
IIS cert:
Algoritmo di firma: sha1RSA
Algoritmo di hash delle firme: sha1
Algoritmo Thumbprint: sha1
Tra questi solo C # cert usa sha512 e nelle suite di crittografia di Client Hello non è specificato sha512. Quindi forse il client trovato dal server non supporta SHA512 usato in C # cert quindi resettare la connessione?