help icon indicating copy to clipboard operation
help copied to clipboard

SSL routines:ssl3_read_bytes:tlsv1 alert internal error:../deps/openssl/openssl/ssl/record/rec_layer_s3.c:1544:SSL alert number 80

Open xcodebuild opened this issue 6 years ago • 3 comments

  • Version: v12.18.3
  • Platform: Darwin xcmac.local 19.6.0 Darwin Kernel Version 19.6.0: Sun Jul 5 00:43:10 PDT 2020; root:xnu-6153.141.1~9/RELEASE_X86_64 x86_64
  • Subsystem:

What steps will reproduce the bug?

n 12.18.3
node --tls-min-v1.0
require('https').get('https://h5api.wapa.taobao.com/h5/mtop.alibaba.atmp.jsconfig.get/1.0/').on('error', e => {console.log(e)})

got output

Error: write EPROTO 4592000448:error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error:../deps/openssl/openssl/ssl/record/rec_layer_s3.c:1544:SSL alert number 80

    at WriteWrap.onWriteComplete [as oncomplete] (internal/stream_base_commons.js:92:16)
    at WriteWrap.callbackTrampoline (internal/async_hooks.js:120:14) {
  errno: 'EPROTO',
  code: 'EPROTO',
  syscall: 'write'

but works in node 8.0.0

How often does it reproduce? Is there a required condition?

always

What is the expected behavior?

No tls-related error.

What do you see instead?

Errors above

Additional information

xcodebuild avatar Aug 11 '20 01:08 xcodebuild

I'm moving this to nodejs/help because I don't think this is an issue with Node.js per se.

The server at h5api.wapa.taobao.com:443 closes the TCP connection before the TLS handshake completes, probably because it doesn't like something that Node.js advertises in its ClientHello.

Here is a hint: it completes the handshake when you tweak ciphers:

tls.connect({host:'h5api.wapa.taobao.com', port:443, ciphers:'ECDHE-ECDSA-AES256-GCM-SHA384'})

bnoordhuis avatar Aug 11 '20 10:08 bnoordhuis

I agree with @bnoordhuis. I think this is an expected behaviour if the 'Hello' handshake is conducted with say, TLS 1.2, but then tries to re-negotiate the secure communication to a lower TLS level cipher of TLS 1.0 or 1.1.

This has been the case for some time. From the openSSL Changelog:

Some servers which support TLS 1.0 can choke if we initially indicate support for TLS 1.2 and later renegotiate using TLS 1.0 in the RSA encrypted premaster secret. As a workaround use the maximum permitted client version in client hello, this should keep such servers happy and still work with previous versions of OpenSSL.

shellberg avatar Aug 11 '20 10:08 shellberg

所以这个问题怎么解决诶?

Summer-Time-2020 avatar Jan 11 '22 12:01 Summer-Time-2020