Skip to content

TLSv1 and TLSv1.1 doesn't work #49210

@afanasy

Description

@afanasy

Version

v18.17.0

Platform

Linux 5.15.0-1033-aws ~20.04.1-Ubuntu SMP Fri Mar 17 11:39:30 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

What steps will reproduce the bug?

Server created with TLSv1 refuses to connect:

var execSync = require('child_process').execSync
var fs = require('fs')
var tls = require('tls')
var port = 8000
var maxVersion = 'TLSv1' // works with TLSv1.2 and TLSv1.3, doesn't work with TLSv1 and TLSv1.1

execSync('openssl req -x509 -newkey rsa:1024 -keyout key -out cert -nodes -subj "/C=US/CN=localhost"')

var key = fs.readFileSync('key')
var cert = fs.readFileSync('cert')

tls.createServer({key, cert, maxVersion}, function (socket) {
  console.log('it works!', socket.getProtocol())
  socket.end()
  this.close()
}).
listen(port, () => {
  tls.connect(8000, {ca: [cert]})
})

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

Always fails

What is the expected behavior? Why is that the expected behavior?

Should support maxVersion: 'TLSv1' and 'TLSv1.1' as specified in the docs
https://nodejs.org/dist/latest-v18.x/docs/api/tls.html#tlscreatesecurecontextoptions

What do you see instead?

Error: C0177008447F0000:error:0A00042E:SSL routines:ssl3_read_bytes:tlsv1 alert protocol version:../deps/openssl/openssl/ssl/record/rec_layer_s3.c:1586:SSL alert number 70

Emitted 'error' event on TLSSocket instance at:
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  library: 'SSL routines',
  reason: 'tlsv1 alert protocol version',
  code: 'ERR_SSL_TLSV1_ALERT_PROTOCOL_VERSION'
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to the documentations.tlsIssues and PRs related to the tls subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions