Skip to content

Commit 821f1a2

Browse files
committed
SERVER-42351 RHEL8 TLS 1.0 and TLS 1.1 protocols are disabled in the DEFAULT system-wide cryptographic policy level
1 parent 1c5724b commit 821f1a2

File tree

3 files changed

+53
-6
lines changed

3 files changed

+53
-6
lines changed

jstests/ssl/libs/ssl_helpers.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,3 +257,34 @@ function detectDefaultTLSProtocol() {
257257
return "TLS1_3";
258258
}
259259
}
260+
261+
function isRHEL8() {
262+
if (_isWindows()) {
263+
return false;
264+
}
265+
266+
// RHEL 8 disables TLS 1.0 and TLS 1.1 as part their default crypto policy
267+
// We skip tests on RHEL 8 that require these versions as a result.
268+
const grep_result = runProgram('grep', 'Ootpa', '/etc/redhat-release');
269+
if (grep_result == 0) {
270+
return true;
271+
}
272+
273+
return false;
274+
}
275+
276+
function sslProviderSupportsTLS1_0() {
277+
if (isRHEL8()) {
278+
return false;
279+
}
280+
281+
return true;
282+
}
283+
284+
function sslProviderSupportsTLS1_1() {
285+
if (isRHEL8()) {
286+
return false;
287+
}
288+
289+
return true;
290+
}

jstests/ssl/ssl_alert_reporting.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ function runTest(serverDisabledProtos, clientDisabledProtos) {
2121
if (implementation === "openssl") {
2222
expectedRegex =
2323
/Error: couldn't connect to server .*:[0-9]*, connection attempt failed: SocketException: tlsv1 alert protocol version/;
24+
25+
// OpenSSL does not send alerts and TLS 1.3 is too difficult to identify as incompatible
26+
// because it shows up in a TLS extension.
27+
if (!sslProviderSupportsTLS1_1()) {
28+
expectedRegex =
29+
/Error: couldn't connect to server .*:[0-9]*, connection attempt failed: SocketException: stream truncated/;
30+
}
31+
2432
} else if (implementation === "windows") {
2533
expectedRegex =
2634
/Error: couldn't connect to server .*:[0-9]*, connection attempt failed: SocketException: The function requested is not supported/;
@@ -51,12 +59,17 @@ function runTest(serverDisabledProtos, clientDisabledProtos) {
5159
clientDisabledProtos);
5260
mongoOutput = rawMongoProgramOutput();
5361
return mongoOutput.match(expectedRegex);
54-
}, "Mongo shell output was as follows:\n" + mongoOutput + "\n************");
62+
}, "Mongo shell output was as follows:\n" + mongoOutput + "\n************", 60 * 1000);
5563

5664
MongoRunner.stopMongod(md);
5765
}
5866

59-
// Client recieves and reports a protocol version alert if it advertises a protocol older than
67+
// Client receives and reports a protocol version alert if it advertises a protocol older than
6068
// the server's oldest supported protocol
61-
runTest("TLS1_0", "TLS1_1,TLS1_2");
69+
if (!sslProviderSupportsTLS1_1()) {
70+
// On platforms that disable TLS 1.1, assume they have TLS 1.3 for this test.
71+
runTest("TLS1_2", "TLS1_3");
72+
} else {
73+
runTest("TLS1_0", "TLS1_1,TLS1_2");
74+
}
6275
}());

jstests/ssl/ssl_count_protocols.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,12 @@ function runTestWithoutSubset(client) {
9292

9393
MongoRunner.stopMongod(conn);
9494
}
95-
96-
runTestWithoutSubset("TLS1_0");
97-
runTestWithoutSubset("TLS1_1");
95+
if (sslProviderSupportsTLS1_0()) {
96+
runTestWithoutSubset("TLS1_0");
97+
}
98+
if (sslProviderSupportsTLS1_1()) {
99+
runTestWithoutSubset("TLS1_1");
100+
}
98101
runTestWithoutSubset("TLS1_2");
99102
runTestWithoutSubset("TLS1_3");
100103
})();

0 commit comments

Comments
 (0)