mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
9cde7a033e
In the manual page, there is a statement that ciphersuites contain explicit default settings - all TLS 1.3 ciphersuites enabled. In node, we assume that an empty setting mean no ciphersuites and we disable TLS 1.3. A correct approach to disabling TLS 1.3 is to disable TLS 1.3 and by not override the default ciphersuits with an empty string. So, only override OpenSSL's TLS 1.3 ciphersuites with an explicit list of ciphers. If none are acceptable, the correct approach is to disable TLS 1.3 instead elsewhere. Fixes: https://github.com/nodejs/node/issues/43419 PR-URL: https://github.com/nodejs/node/pull/43427 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: James M Snell <jasnell@gmail.com>
55 lines
1.3 KiB
JavaScript
55 lines
1.3 KiB
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
|
|
const assert = require('assert');
|
|
const tls = require('tls');
|
|
const fixtures = require('../common/fixtures');
|
|
|
|
const options = {
|
|
pfx: [
|
|
{
|
|
buf: fixtures.readKey('agent1.pfx'),
|
|
passphrase: 'sample'
|
|
},
|
|
fixtures.readKey('ec.pfx'),
|
|
]
|
|
};
|
|
|
|
const ciphers = [];
|
|
|
|
const server = tls.createServer(options, function(conn) {
|
|
conn.end('ok');
|
|
}).listen(0, function() {
|
|
const ecdsa = tls.connect(this.address().port, {
|
|
ciphers: 'ECDHE-ECDSA-AES256-GCM-SHA384',
|
|
maxVersion: 'TLSv1.2',
|
|
rejectUnauthorized: false,
|
|
}, common.mustCall(function() {
|
|
ciphers.push(ecdsa.getCipher());
|
|
const rsa = tls.connect(server.address().port, {
|
|
ciphers: 'ECDHE-RSA-AES256-GCM-SHA384',
|
|
maxVersion: 'TLSv1.2',
|
|
rejectUnauthorized: false,
|
|
}, common.mustCall(function() {
|
|
ciphers.push(rsa.getCipher());
|
|
ecdsa.end();
|
|
rsa.end();
|
|
server.close();
|
|
}));
|
|
}));
|
|
});
|
|
|
|
process.on('exit', function() {
|
|
assert.deepStrictEqual(ciphers, [{
|
|
name: 'ECDHE-ECDSA-AES256-GCM-SHA384',
|
|
standardName: 'TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384',
|
|
version: 'TLSv1.2'
|
|
}, {
|
|
name: 'ECDHE-RSA-AES256-GCM-SHA384',
|
|
standardName: 'TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384',
|
|
version: 'TLSv1.2'
|
|
}]);
|
|
});
|