[SERVER-31701] Shell cannot connect with --ssl to a mongod with TLS1_0 disabled Created: 24/Oct/17  Updated: 30/Oct/23  Resolved: 22/Apr/22

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: 3.4.9
Fix Version/s: features we're not sure of

Type: Improvement Priority: Major - P3
Reporter: Vick Mena (Inactive) Assignee: Backlog - Security Team
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Server Security
Backwards Compatibility: Fully Compatible
Participants:

 Description   

Shell cannot connect to mongod with TLS1_0 disabled

The mongod log file

tail mongod.log
2017-10-24T14:13:27.180-0400 I CONTROL  [initandlisten]
2017-10-24T14:13:27.180-0400 I CONTROL  [initandlisten] ** WARNING: No SSL certificate validation can be performed since no CA file has been provided
2017-10-24T14:13:27.180-0400 I CONTROL  [initandlisten] **          Please specify an sslCAFile parameter.
2017-10-24T14:13:27.180-0400 I CONTROL  [initandlisten]
2017-10-24T14:13:27.182-0400 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory '/data/diagnostic.data'
2017-10-24T14:13:27.182-0400 I NETWORK  [thread1] waiting for connections on port 27017 ssl
2017-10-24T14:13:28.011-0400 I FTDC     [ftdc] Unclean full-time diagnostic data capture shutdown detected, found interim file, some metrics may have been lost. OK
2017-10-24T14:13:29.984-0400 I NETWORK  [thread1] connection accepted from 127.0.0.1:53537 #1 (1 connection now open)
2017-10-24T14:13:29.984-0400 E NETWORK  [conn1] SSL: error:140760FC:SSL routines:SSL23_GET_CLIENT_HELLO:unknown protocol
2017-10-24T14:13:29.984-0400 I -        [conn1] end connection 127.0.0.1:53537 (1 connection now open)



 Comments   
Comment by Spencer Jackson [ 10/Jan/20 ]

The server and shell now use SecureTransport on OS X, solving the issue that was initially reported. The general request that it shouldn't be possible to start processes with no usable TLS protocols is still legitimate, but seems like an improvement rather than a bug. I'm reclassifying this ticket.

Comment by Spencer Jackson [ 27/Oct/17 ]

We pass a bitset of disabled protocols down to OpenSSL. When TLS 1.3 is released, it seams reasonable people will want to disable all protocols except 1.3. So, they will need to be able to disable all known protocol revisions. We will have to do additional work to figure out how to disable the new protocol.

We could do a compile-time check as to what preprocessor macros were declared by OpenSSL, and use that to make a guess about what protocols are supported. However, from the OpenSSL blog:

The forthcoming OpenSSL 1.1.1 release will include support for TLSv1.3. The new release will be binary and API compatible with OpenSSL 1.1.0. In theory, if your application supports OpenSSL 1.1.0, then all you need to do to upgrade is to drop in the new version of OpenSSL when it becomes available and you will automatically start being able to use TLSv1.3.

This means if we built binaries against 1.1.0 which made this check at compile time, they might mistakenly error out if ran with newer libraries. This is just a specific example. Maintaining forwards and backwards compatibility with OpenSSL's APIs and ABIs is... tricky.

There is a newer API for setting supported protocols, but it only exists in 1.1.0+. It's not available on our supported platforms yet, and will never exist on OS X. It might be able to return an error if no protocols are enabled. This will probably be the best way to do this, but it's isn't viable just yet.

Comment by Mark Benvenuto [ 24/Oct/17 ]

After talking with vick.mena, the issue is that on MacOS X, MongoD is linked to "OpenSSL 0.9.8zh 14 Jan 2016" which does not support TLS 1.1, and TLS 1.2. This means we allowed the user to start an invalid configuration in this case. We could error if the user disables all supported TLS versions. MongoD already disables SSLv2 and SSLv3.

Comment by Mark Benvenuto [ 24/Oct/17 ]

Which OS are you running?

I does not repro for me with MongoDB 3.4.9 on Fedora 26 with OpenSSL 1.1.0f-fips 25 May 2017.

Client:
./mongo --verbose --ssl --sslAllowInvalidHostnames --port=12345 --sslCAFile=/home/mark/mongo/jstests/libs/ca.pem --sslPEMKeyFile=/home/mark/mongo/jstests/libs/client.pem

Server
./mongod --sslMode requireSSL --sslDisabledProtocols TLS1_0 --sslPEMKeyFile /home/mark/mongo/jstests/libs/server.pem --dbpath=foo --port=12345 --sslCAFile=/home/mark/mongo/jstests/libs/ca.pem --vv

Note: /home/mark/mongo is mongo repo with test certificates

Generated at Thu Feb 08 04:27:56 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.