@@ -31,19 +31,8 @@ Clients must have support for TLS/SSL to connect to a
3131
3232.. _mongo-shell-tls-connect:
3333
34- ``mongosh`` Configuration (Using ``tls`` Options)
35- -------------------------------------------------
36-
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`.
34+ MongoDB Shell
35+ -------------
4736
4837:binary:`~bin.mongosh` provides various TLS/SSL settings,
4938including:
@@ -111,14 +100,8 @@ certificate presented by the :binary:`~bin.mongod` or
111100
112101.. _tls-client-connection-only:
113102
114- Connect to MongoDB Instance Using Encryption (``tls`` Options)
115- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
116-
117- .. note::
118-
119- The procedure uses the ``tls`` options (available starting in
120- MongoDB 4.2). For procedures using their ``ssl`` aliases, see
121- :ref:`mongo-shell-ssl-connect`.
103+ Connect to MongoDB Instances Using Encryption
104+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
122105
123106To connect to a :binary:`~bin.mongod` or :binary:`~bin.mongos` instance
124107that requires :ref:`encrypted communication <ssl-mongod-ssl-cert-key>`,
@@ -149,14 +132,8 @@ the CA file.
149132
150133.. _mongo-connect-require-client-certificates-tls:
151134
152- Connect to MongoDB Instance that Requires Client Certificates (``tls`` Options)
153- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
154-
155- .. note::
156-
157- The procedure uses the ``tls`` options (available starting in
158- MongoDB 4.2). For procedures using their ``ssl`` aliases, see
159- :ref:`mongo-shell-ssl-connect`.
135+ Connect to MongoDB Instances that Require Client Certificates
136+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
160137
161138To connect to a :binary:`~bin.mongod` or :binary:`~bin.mongos` that
162139requires :ref:`CA-signed client certificates
@@ -237,162 +214,6 @@ Avoid Use of ``--tlsAllowInvalidCertificates`` Option
237214 hostname in the TLS/SSL certificates, see
238215 :option:`--tlsAllowInvalidHostnames <mongosh --tlsAllowInvalidHostnames>`.
239216
240- .. _mongo-shell-ssl-connect:
241-
242- ``mongosh`` Configuration (Using ``ssl`` Options)
243- -------------------------------------------------
244-
245- :binary:`~bin.mongosh` provides various TLS/SSL settings, including:
246-
247- .. list-table::
248- :header-rows: 1
249- :widths: 30 70
250-
251- * - SSL Option (Deprecated in 4.2)
252- - Notes
253-
254- * - ``--ssl``
255- - Enables TLS/SSL connection.
256-
257- * - ``--sslPEMKeyFile``
258-
259- - Specifies the :file:`.pem` file that contains
260- :binary:`~bin.mongosh`'s certificate and key to present to
261- the :binary:`~bin.mongod` or :binary:`~bin.mongos` instance.
262-
263- * - ``--sslPEMKeyPassword``
264-
265- - If :binary:`~bin.mongosh`'s certificate key file is encrypted.
266-
267- * - ``--sslCAFile``
268-
269- - Specifies the Certificate Authority (CA) :file:`.pem` file for
270- verification of the certificate presented by the
271- :binary:`~bin.mongod` or the :binary:`~bin.mongos` instance.
272-
273- * - ``--sslCertificateSelector``
274-
275- - If running on Windows or macOS, use a certificate from the
276- system certificate store. (*New in version 4.0*)
277-
278- For a complete list of ``ssl``
279- options, see :mongosh:`SSL Options <mongosh-ssl>`.
280-
281- For TLS/SSL connections, :binary:`~bin.mongosh` validates the
282- certificate presented by the :binary:`~bin.mongod` or
283- :binary:`~bin.mongos` instance:
284-
285- - :binary:`~bin.mongosh` verifies that the certificate is from
286- the specified Certificate Authority ``--sslCAFile``. If the
287- certificate is not from the specified CA, :binary:`~bin.mongosh`
288- will fail to connect.
289-
290- - .. include:: /includes/extracts/ssl-facts-mongo-ssl-hostname-verification.rst
291-
292- To connect :binary:`~bin.mongosh` to a :binary:`~bin.mongod` or
293- :binary:`~bin.mongos` that requires TLS/SSL, specify the
294- :option:`--host <mongosh --host>` option or use a :doc:`connection
295- string </reference/connection-string>` to specify the hostname. All
296- other ``TLS/SSL`` options must be specified using the command-line
297- options.
298-
299- .. _ssl-client-connection-only:
300-
301- Connect to MongoDB Instance Using Encryption (``--ssl`` Options)
302- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
303-
304- .. note::
305-
306- The procedure uses the ``ssl`` options. For procedures using the
307- ``tls`` aliases (available starting in MongoDB 4.2), see
308- :mongosh:`mongo-shell-tls`.
309-
310- To connect to a :binary:`~bin.mongod` or :binary:`~bin.mongos` instance
311- that requires :ref:`encrypted communication <ssl-mongod-ssl-cert-key>`,
312- start :binary:`~bin.mongosh` with:
313-
314- - ``--ssl``
315-
316- - :option:`--host <mongosh --host>` and ``--sslCAFile`` to validate the
317- server certificate.
318-
319- For example, consider a :binary:`~bin.mongod` instance running on
320- ``hostname.example.com`` with the following options:
321-
322- .. code-block:: bash
323-
324- mongod --sslMode requireSSL --sslPEMKeyFile <pem>
325-
326- To connect to the instance, start :binary:`~bin.mongosh` with the
327- following options:
328-
329- .. code-block:: bash
330-
331- mongosh --ssl --host hostname.example.com --sslCAFile /etc/ssl/caToValidateServerCertificates.pem
332-
333- :binary:`~bin.mongosh` verifies the certificate presented by
334- the :binary:`~bin.mongod` instance against the specified hostname
335- and the CA file.
336-
337- .. _mongo-connect-require-client-certificates-ssl:
338-
339- Connect to MongoDB Instance that Requires Client Certificates (``ssl`` Options)
340- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
341-
342- .. note::
343-
344- The procedure uses the ``ssl`` options. For procedures using the
345- ``tls`` aliases (available starting in MongoDB 4.2), see
346- :ref:`mongo-shell-tls-connect`.
347-
348- To connect to a :binary:`~bin.mongod` or :binary:`~bin.mongos` that
349- requires :ref:`CA-signed client certificates
350- <ssl-mongod-ca-signed-ssl-cert-key>`, start :binary:`~bin.mongosh` with:
351-
352- - ``--ssl``
353-
354- - :option:`--host <mongosh --host>` and the ``--sslCAFile`` to
355- validate the server certificate,
356-
357- - ``--sslPEMKeyFile`` option to specify
358- the client certificate to present to the server.
359-
360- For example, consider a :binary:`~bin.mongod` instance running on
361- ``hostname.example.com`` with the following options:
362-
363- .. code-block:: bash
364-
365- mongod --sslMode requireSSL --sslPEMKeyFile /etc/ssl/mongodb.pem --sslCAFile /etc/ssl/ca.pem
366-
367- To connect to the instance, start :binary:`~bin.mongosh` with the
368- following options:
369-
370- .. code-block:: bash
371-
372- mongosh --ssl --host hostname.example.com --sslPEMKeyFile /etc/ssl/client.pem --sslCAFile /etc/ssl/ca.pem
373-
374- On Windows and macOS
375- ````````````````````
376-
377- You can also use the ``--sslCertificateSelector`` option to specify the
378- client certificate from the system certificate store instead of using
379- ``--sslPEMKeyFile``. If the CA file is also in the system certificate
380- store, you can omit the ``--sslCAFile`` option.
381-
382- For example, to use a certificate with the ``CN`` (Common Name) of
383- ``myclient.example.net`` and the CA file from the system certificate
384- store on macOS, start :binary:`~bin.mongosh` with the following
385- options:
386-
387- .. code-block:: bash
388-
389- mongosh --ssl --host hostname.example.com --sslCertificateSelector subject=myclient.example.net
390-
391- Avoid Use of ``--sslAllowInvalidCertificates`` Option
392- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
393-
394- .. include:: /includes/extracts/ssl-facts-invalid-cert-warning-clients.rst
395-
396217|atlas|, |MMS| and MongoDB Ops Manager
397218--------------------------------------
398219
@@ -445,9 +266,9 @@ tools include:
445266- :binary:`~bin.mongostat`
446267- :binary:`~bin.mongotop`
447268
448- To use encrypted communication with these tools, use the same ``ssl `` options as
449- :binary:`~bin.mongosh`. See :ref:`mongo-shell-ssl -connect`.
269+ To use encrypted communication with these tools, use the same ``tls `` options as
270+ :binary:`~bin.mongosh`. See :ref:`mongo-shell-tls -connect`.
450271
451272.. seealso::
452273
453- :doc:`/tutorial/ configure-ssl`
274+ :ref:` configure-mongod-mongos-for-tls -ssl`
0 commit comments