Repository navigation
"ERR_SSL_NO_CIPHER_MATCH" error when specifying TLS cipher suites #49699
Copy link
Copy link
Closed
Labels
confirmed-bugIssues and PRs for confirmed bugs.Issues and PRs for confirmed bugs.httpsIssues and PRs related to the https subsystem.Issues and PRs related to the https subsystem.tlsIssues and PRs related to the tls subsystem.Issues and PRs related to the tls subsystem.
Description
Activity
- addedtlsIssues and PRs related to the tls subsystem.Issues and PRs related to the tls subsystem.httpsIssues and PRs related to the https subsystem.Issues and PRs related to the https subsystem.
on Sep 18, 2023 This is the result of node trying to make the
ciphersoption work for both TLSv1.2 and 1.3 because openssl has different APIs for them (SSL_CTX_set_cipher_list vs. SSL_CTX_set_ciphersuites.)Node parses the string but it doesn't understand bang syntax and treats it as a TLSv1.2 cipher. PR welcome. Untested, but I think the fix looks something like this:
diff --git a/lib/internal/tls/secure-context.js b/lib/internal/tls/secure-context.js index 36d33e6ac8..0fa3098ffa 100644 --- a/lib/internal/tls/secure-context.js +++ b/lib/internal/tls/secure-context.js @@ -99,21 +99,25 @@ function processCiphers(ciphers, name) { const cipherList = ArrayPrototypeJoin( ArrayPrototypeFilter( ciphers, (cipher) => { - return cipher.length > 0 && - !StringPrototypeStartsWith(cipher, 'TLS_'); + if (cipher.length === 0) return false; + if (StringPrototypeStartsWith(cipher, 'TLS_')) return false; + if (StringPrototypeStartsWith(cipher, '!TLS_')) return false; + return true; }), ':'); const cipherSuites = ArrayPrototypeJoin( ArrayPrototypeFilter( ciphers, (cipher) => { - return cipher.length > 0 && - StringPrototypeStartsWith(cipher, 'TLS_'); + if (cipher.length === 0) return false; + if (StringPrototypeStartsWith(cipher, 'TLS_')) return true; + if (StringPrototypeStartsWith(cipher, '!TLS_')) return true; + return false; }), ':'); // Specifying empty cipher suites for both TLS1.2 and TLS1.3 is invalid, its // not possible to handshake with no suites. if (cipherSuites === '' && cipherList === '')
- addedconfirmed-bugIssues and PRs for confirmed bugs.Issues and PRs for confirmed bugs.
on Sep 18, 2023 - added a commit that references this issue
on Oct 4, 2023 - added a commit that references this issue
on Nov 11, 2023 - added a commit that references this issue
on Apr 15, 2024
Metadata
Metadata
Assignees
Labels
confirmed-bugIssues and PRs for confirmed bugs.Issues and PRs for confirmed bugs.httpsIssues and PRs related to the https subsystem.Issues and PRs related to the https subsystem.tlsIssues and PRs related to the tls subsystem.Issues and PRs related to the tls subsystem.
Version
v18.17.1
Platform
Darwin 22.6.0 Darwin Kernel Version 22.6.0: Wed Jul 5 22:22:05 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T6000 arm64
Subsystem
tls
What steps will reproduce the bug?
Run
Weirdly, setting
ECDHE-RSA-AES128-GCM-SHA256at the end like'TLS_AES_256_GCM_SHA384:!TLS_CHACHA20_POLY1305_SHA256:ECDHE-RSA-AES128-GCM-SHA256'causes it work work even though'ECDHE-RSA-AES128-GCM-SHA256'is fromTLSv1.2.How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
The call to
https.createServershould succeed and use the cipher suites specified AND (bonus) disallow specifying cipher suites not supported by the current protocol.What do you see instead?
Additional information