Skip to content

Commit 408bffe

Browse files
author
Julien Gilli
committed
test: fix ssl/tls options matrix test
The tests suite available in test/external/ssl-options was originally written for security fixes made in the v0.10 branch. In this branch, the client's default ciphers list is compatible with SSLv2. After merging this change from v0.10 to v0.12, this tests suite was broken because commits 5d2aef1 and f4c8020 make SSL/TLS clients use a default ciphers list that is not compatible with the SSLv2 protocol. This change fixes two issues: 1) The cipher list that was setup for a given test was not passed properly to the client. 2) When either or both of clients/servers were using SSLv2, tests were expected to succeed when at least the server end was using SSLv2 compatible ciphers. Now, tests are expected to succeed only if SSLv2 compatible ciphers are used on both ends. Fixes #9020. Reviewed-by: Trevor Norris <[email protected]>
1 parent ae00e97 commit 408bffe

File tree

1 file changed

+13
-21
lines changed

1 file changed

+13
-21
lines changed

test/external/ssl-options/test.js

+13-21
Original file line numberDiff line numberDiff line change
@@ -169,26 +169,17 @@ function testSetupsCompatible(serverSetup, clientSetup) {
169169
return false;
170170
}
171171

172-
if (isSsl2Protocol(serverSetup.secureProtocol) ||
173-
isSsl2Protocol(clientSetup.secureProtocol)) {
174-
175-
/*
176-
* It seems that in order to be able to use SSLv2, at least the server
177-
* *needs* to advertise at least one cipher compatible with it.
178-
*/
179-
if (serverSetup.ciphers !== SSL2_COMPATIBLE_CIPHERS) {
180-
return false;
181-
}
182-
183-
/*
184-
* If only either one of the client or server specify SSLv2 as their
185-
* protocol, then *both* of them *need* to advertise at least one cipher
186-
* that is compatible with SSLv2.
187-
*/
188-
if ((!isSsl2Protocol(serverSetup.secureProtocol) || !isSsl2Protocol(clientSetup.secureProtocol)) &&
189-
(clientSetup.ciphers !== SSL2_COMPATIBLE_CIPHERS || serverSetup.ciphers !== SSL2_COMPATIBLE_CIPHERS)) {
190-
return false;
191-
}
172+
var ssl2Used = isSsl2Protocol(serverSetup.secureProtocol) ||
173+
isSsl2Protocol(clientSetup.secureProtocol);
174+
if (ssl2Used &&
175+
((serverSetup.ciphers !== SSL2_COMPATIBLE_CIPHERS) ||
176+
(clientSetup.ciphers !== SSL2_COMPATIBLE_CIPHERS))) {
177+
/*
178+
* Default ciphers are not compatible with SSLv2. Both client *and*
179+
* server need to specify a SSLv2 compatible cipher to be able to use
180+
* SSLv2.
181+
*/
182+
return false;
192183
}
193184

194185
return true;
@@ -340,7 +331,8 @@ function runClient(port, secureProtocol, secureOptions, ciphers) {
340331
{
341332
rejectUnauthorized: false,
342333
secureProtocol: secureProtocol,
343-
secureOptions: secureOptions
334+
secureOptions: secureOptions,
335+
ciphers: ciphers
344336
},
345337
function() {
346338

0 commit comments

Comments
 (0)