@@ -31,19 +31,9 @@ Clients must have support for TLS/SSL to connect to a
3131
3232.. _mongo-shell-tls-connect:
3333
34- ``mongo`` Shell Configuration (Using ``tls`` Options)
35- -------------------------------------------------------
3634
37- .. note::
38-
39- Starting in version 4.2, MongoDB provides ``tls`` options that
40- corresponds to the ``ssl`` options. The ``tls`` options provide
41- **identical** functionality as the ``ssl`` options since MongoDB has
42- always supported TLS 1.0 and later.
43-
44- The procedures in this section use the ``tls`` options. For
45- procedures using their ``ssl`` aliases, see
46- :ref:`mongo-shell-ssl-connect`.
35+ MongoDB Shell
36+ -------------
4737
4838The :binary:`~bin.mongo` shell provides various TLS/SSL settings,
4939including:
@@ -102,14 +92,8 @@ certificate presented by the :binary:`~bin.mongod` or
10292
10393.. _tls-client-connection-only:
10494
105- Connect to MongoDB Instance Using Encryption (``tls`` Options)
106- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
107-
108- .. note::
109-
110- The procedure uses the ``tls`` options (available starting in
111- MongoDB 4.2). For procedures using their ``ssl`` aliases, see
112- :ref:`mongo-shell-ssl-connect`.
95+ Connect to MongoDB Instances Using Encryption
96+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11397
11498To connect to a :binary:`~bin.mongod` or :binary:`~bin.mongos` instance
11599that requires :ref:`encrypted communication <ssl-mongod-ssl-cert-key>`,
@@ -140,14 +124,8 @@ the CA file.
140124
141125.. _mongo-connect-require-client-certificates-tls:
142126
143- Connect to MongoDB Instance that Requires Client Certificates (``tls`` Options)
144- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
145-
146- .. note::
147-
148- The procedure uses the ``tls`` options (available starting in
149- MongoDB 4.2). For procedures using their ``ssl`` aliases, see
150- :ref:`mongo-shell-ssl-connect`.
127+ Connect to MongoDB Instances that Require Client Certificates
128+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
151129
152130To connect to a :binary:`~bin.mongod` or :binary:`~bin.mongos` that
153131requires :ref:`CA-signed client certificates
@@ -228,164 +206,6 @@ Avoid Use of ``--tlsAllowInvalidCertificates`` Option
228206 hostname in the TLS/SSL certificates, see
229207 :option:`--tlsAllowInvalidHostnames <mongo --tlsAllowInvalidHostnames>`.
230208
231- .. _mongo-shell-ssl-connect:
232-
233- ``mongo`` Shell Configuration (Using ``ssl`` Options)
234- ------------------------------------------------------
235-
236- The :binary:`~bin.mongo` shell provides various TLS/SSL settings,
237- including:
238-
239- .. list-table::
240- :header-rows: 1
241- :widths: 30 70
242-
243- * - SSL Option (Deprecated in 4.2)
244- - Notes
245-
246- * - :option:`--ssl <mongo --ssl>`
247- - Enables TLS/SSL connection.
248-
249- * - :option:`--sslPEMKeyFile <mongo --sslPEMKeyFile>`
250-
251- - Specifies the :file:`.pem` file that contains the
252- :binary:`~bin.mongo` shell's certificate and key to present to
253- the :binary:`~bin.mongod` or :binary:`~bin.mongos` instance.
254-
255- * - :option:`--sslPEMKeyPassword <mongo --sslPEMKeyPassword>`
256-
257- - If the :binary:`~bin.mongo` shell's certificate key file is encrypted.
258-
259- * - :option:`--sslCAFile <mongo --sslCAFile>`
260-
261- - Specifies the Certificate Authority (CA) :file:`.pem` file for
262- verification of the certificate presented by the
263- :binary:`~bin.mongod` or the :binary:`~bin.mongos` instance.
264-
265- * - :option:`--sslCertificateSelector <mongo --sslCertificateSelector>`
266-
267- - If running on Windows or macOS, use a certificate from the
268- system certificate store. (*New in version 4.0*)
269-
270- For a complete list of the :binary:`~bin.mongo` shell's ``ssl``
271- options, see :ref:`SSL Options <mongo-shell-ssl>`.
272-
273- For TLS/SSL connections, the :binary:`~bin.mongo` shell validates the
274- certificate presented by the :binary:`~bin.mongod` or
275- :binary:`~bin.mongos` instance:
276-
277- - The :binary:`~bin.mongo` shell verifies that the certificate is from
278- the specified Certificate Authority :option:`--sslCAFile <mongo
279- --sslCAFile>`. If the certificate is not from the specified CA, the
280- :binary:`~bin.mongo` shell will fail to connect.
281-
282- - .. include:: /includes/extracts/ssl-facts-mongo-ssl-hostname-verification.rst
283-
284- To connect a :binary:`~bin.mongo` shell to a :binary:`~bin.mongod` or
285- :binary:`~bin.mongos` that requires TLS/SSL, specify the
286- :option:`--host <mongo --host>` option or use a :doc:`connection
287- string </reference/connection-string>` to specify the hostname. All
288- other ``TLS/SSL`` options must be specified using the command-line
289- options.
290-
291- .. _ssl-client-connection-only:
292-
293- Connect to MongoDB Instance Using Encryption (``--ssl`` Options)
294- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
295-
296- .. note::
297-
298- The procedure uses the ``ssl`` options. For procedures using the
299- ``tls`` aliases (available starting in MongoDB 4.2), see
300- :ref:`mongo-shell-tls-connect`.
301-
302- To connect to a :binary:`~bin.mongod` or :binary:`~bin.mongos` instance
303- that requires :ref:`encrypted communication <ssl-mongod-ssl-cert-key>`,
304- start the :binary:`~bin.mongo` shell with:
305-
306- - :option:`--ssl <mongo --ssl>`
307-
308- - :option:`--host <mongo --host>` and :option:`--sslCAFile <mongo
309- --sslCAFile>` to validate the server certificate.
310-
311- For example, consider a :binary:`~bin.mongod` instance running on
312- ``hostname.example.com`` with the following options:
313-
314- .. code-block:: sh
315-
316- mongod --sslMode requireSSL --sslPEMKeyFile <pem>
317-
318- To connect to the instance, start a :binary:`~bin.mongo` shell with the
319- following options:
320-
321- .. code-block:: sh
322-
323- mongo --ssl --host hostname.example.com --sslCAFile /etc/ssl/caToValidateServerCertificates.pem
324-
325- The :binary:`~bin.mongo` shell verifies the certificate presented by
326- the :binary:`~bin.mongod` instance against the specified hostname
327- and the CA file.
328-
329- .. _mongo-connect-require-client-certificates-ssl:
330-
331- Connect to MongoDB Instance that Requires Client Certificates (``ssl`` Options)
332- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
333-
334- .. note::
335-
336- The procedure uses the ``ssl`` options. For procedures using the
337- ``tls`` aliases (available starting in MongoDB 4.2), see
338- :ref:`mongo-shell-tls-connect`.
339-
340- To connect to a :binary:`~bin.mongod` or :binary:`~bin.mongos` that
341- requires :ref:`CA-signed client certificates
342- <ssl-mongod-ca-signed-ssl-cert-key>`, start the :binary:`~bin.mongo`
343- shell with:
344-
345- - :option:`--ssl <mongo --ssl>`
346-
347- - :option:`--host <mongo --host>` and the :option:`--sslCAFile <mongo
348- --sslCAFile>` to validate the server certificate,
349-
350- - :option:`--sslPEMKeyFile <mongo --sslPEMKeyFile>` option to specify
351- the client certificate to present to the server.
352-
353- For example, consider a :binary:`~bin.mongod` instance running on
354- ``hostname.example.com`` with the following options:
355-
356- .. code-block:: sh
357-
358- mongod --sslMode requireSSL --sslPEMKeyFile /etc/ssl/mongodb.pem --sslCAFile /etc/ssl/ca.pem
359-
360- To connect to the instance, start a :binary:`~bin.mongo` shell with the
361- following options:
362-
363- .. code-block:: sh
364-
365- mongo --ssl --host hostname.example.com --sslPEMKeyFile /etc/ssl/client.pem --sslCAFile /etc/ssl/ca.pem
366-
367- On Windows and macOS
368- ````````````````````
369-
370- You can also use the ``--sslCertificateSelector`` option to specify the
371- client certificate from the system certificate store instead of using
372- ``--sslPEMKeyFile``. If the CA file is also in the system certificate
373- store, you can omit the ``--sslCAFile`` option.
374-
375- For example, to use a certificate with the ``CN`` (Common Name) of
376- ``myclient.example.net`` and the CA file from the system certificate
377- store on macOS, start :binary:`~bin.mongosh` with the following
378- options:
379-
380- .. code-block:: bash
381-
382- mongosh --ssl --host hostname.example.com --sslCertificateSelector subject=myclient.example.net
383-
384- Avoid Use of ``--sslAllowInvalidCertificates`` Option
385- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
386-
387- .. include:: /includes/extracts/ssl-facts-invalid-cert-warning-clients.rst
388-
389209|atlas|, |MMS| and MongoDB Ops Manager
390210--------------------------------------
391211
@@ -444,7 +264,9 @@ tools include:
444264 - :binary:`~bin.mongostat`
445265 - :binary:`~bin.mongotop`
446266
447- To use encrypted communication with these tools, use the same ``ssl`` options as
448- the :binary:`~bin.mongo` shell. See :ref:`mongo-shell-ssl-connect`.
267+ To use encrypted communication with these tools, use the same ``tls`` options as
268+ :binary:`~bin.mongosh`. See :ref:`mongo-shell-tls-connect`.
269+
270+ .. seealso::
449271
450- .. seealso:: :doc:`/tutorial/ configure-ssl`
272+ :ref:` configure-mongod-mongos-for-tls -ssl`
0 commit comments