You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Microsoft Windows NT 10.0.22631.0 x64
also reproducible under:
Darwin 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6000 arm64
Subsystem
tls
What steps will reproduce the bug?
Generate the certs and then run the server.js and then the client.js.
// server.jsconsttls=require('tls');constfs=require('fs');constoptions={key: fs.readFileSync('certs/key.pem'),cert: fs.readFileSync('certs/cert.pem'),requestCert: false,rejectUnauthorized: false,secureProtocol: 'TLSv1_2_method',// Force TLS 1.2};constserver=tls.createServer(options,(socket)=>{console.log(`Secure connection established using ${socket.getProtocol()}`);socket.on('data',(data)=>{console.log('Received:',data.toString());});socket.write('\n_renegotiating\n');socket.renegotiate({requestCert: true,rejectUnauthorized: true},(err)=>{if(err){console.error('Renegotiation error:',err);}else{console.log('Renegotiation successful');socket.end('\n_renegotiated\n');}});});server.listen(8443,()=>{console.log('Server listening on port 8443');});server.on('tlsClientError',(err)=>{console.error('TLS Client Error:',err);});
How often does it reproduce? Is there a required condition?
TLS 1.2.
server re-negotiates the TLS connections with client certificates.
What is the expected behavior? Why is that the expected behavior?
secureConnect events fires once.
What do you see instead?
secureConnect event fires multiple times.
Additional information
This got surfaced when using IIS on Windows Server. Windows Server does use negotiation when using client-certificates.
When passing a callback to tls.connect (which is similar to secureConnect this won't surface, since its using once() internally.
Certain https servers like Microsoft IIS aka. TLS servers do the TLS
renegotiation after the TLS handshake. This ends up in two
`'secureConnect'` events due to an upstream Node.js bug:
nodejs/node#54362
Drive-by: Move other listeners like `'close'` / `'end'` to `once()` as
well.
Relates #32004
mxschmitt
added a commit
to microsoft/playwright
that referenced
this issue
Aug 14, 2024
…enegotiation
Certain https servers like Microsoft IIS aka. TLS servers do the TLS
renegotiation after the TLS handshake. This ends up in two
`'secureConnect'` events due to an upstream Node.js bug:
nodejs/node#54362
Drive-by: Move other listeners like `'close'` / `'end'` to `once()` as
well.
Relates #32004
Version
22.6.0
Platform
Subsystem
tls
What steps will reproduce the bug?
Generate the certs and then run the
server.js
and then theclient.js
.How often does it reproduce? Is there a required condition?
What is the expected behavior? Why is that the expected behavior?
secureConnect
events fires once.What do you see instead?
secureConnect
event fires multiple times.Additional information
This got surfaced when using IIS on Windows Server. Windows Server does use negotiation when using client-certificates.
When passing a callback to
tls.connect
(which is similar tosecureConnect
this won't surface, since its usingonce()
internally.Logs:
The text was updated successfully, but these errors were encountered: