@@ -31,19 +31,8 @@ Clients must have support for TLS/SSL to connect to a
31
31
32
32
.. _mongo-shell-tls-connect:
33
33
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
+ -------------
47
36
48
37
:binary:`~bin.mongosh` provides various TLS/SSL settings,
49
38
including:
@@ -111,14 +100,8 @@ certificate presented by the :binary:`~bin.mongod` or
111
100
112
101
.. _tls-client-connection-only:
113
102
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
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
122
105
123
106
To connect to a :binary:`~bin.mongod` or :binary:`~bin.mongos` instance
124
107
that requires :ref:`encrypted communication <ssl-mongod-ssl-cert-key>`,
@@ -149,14 +132,8 @@ the CA file.
149
132
150
133
.. _mongo-connect-require-client-certificates-tls:
151
134
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
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
160
137
161
138
To connect to a :binary:`~bin.mongod` or :binary:`~bin.mongos` that
162
139
requires :ref:`CA-signed client certificates
@@ -237,162 +214,6 @@ Avoid Use of ``--tlsAllowInvalidCertificates`` Option
237
214
hostname in the TLS/SSL certificates, see
238
215
:option:`--tlsAllowInvalidHostnames <mongosh --tlsAllowInvalidHostnames>`.
239
216
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
-
396
217
|atlas|, |MMS| and MongoDB Ops Manager
397
218
--------------------------------------
398
219
@@ -445,9 +266,9 @@ tools include:
445
266
- :binary:`~bin.mongostat`
446
267
- :binary:`~bin.mongotop`
447
268
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`.
450
271
451
272
.. seealso::
452
273
453
- :doc:`/tutorial/ configure-ssl`
274
+ :ref:` configure-mongod-mongos-for-tls -ssl`
0 commit comments