You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/reference/content/tutorials/connect/ssl.md
+28-61Lines changed: 28 additions & 61 deletions
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,6 @@ title = "SSL Settings"
13
13
The Node.js driver supports TLS/SSL connections to MongoDB that support TLS/SSL support.
14
14
15
15
## No Certificate Validation
16
-
17
16
If the MongoDB instance does not perform any validation of the certificate chain, include the `ssl=true` in the [URI Connection String ](https://docs.mongodb.org/manual/reference/connection-string/).
18
17
19
18
```js
@@ -22,16 +21,14 @@ var MongoClient = require('mongodb').MongoClient;
By default, the driver ensures that the hostname included in the
58
52
server's SSL certificate(s) matches the hostname(s) provided in the URI connection string. If you need to disable the hostname verification, but otherwise validate the server's certificate, pass to the `MongoClient.connect` method:
59
53
60
54
- A [URI Connection String ](https://docs.mongodb.org/manual/reference/connection-string/) that includes `ssl=true` setting,
61
55
62
-
- A connections options for the `server`with the certificate for the Certificate Authority (`sslCA`) and the `sslValidate` setting set to `true` but `checkServerIdentity` set to `false`.
56
+
- A connections options with the certificate for the Certificate Authority (`sslCA`) and the `sslValidate` setting set to `true` but `checkServerIdentity` set to `false`.
63
57
64
58
```js
65
59
var MongoClient =require('mongodb').MongoClient,
@@ -71,24 +65,21 @@ var ca = [fs.readFileSync(__dirname + "/ssl/ca.pem")];
71
65
72
66
// Connect validating the returned certificates from the server
## Validate Server Certificate and Present Valid Certificate
85
-
86
77
If the MongoDB server performs certificate validation, the client must pass its
87
78
certificate to the server. To pass the client's certificate as well as to validate the server's certificate, pass to the `MongoClient.connect` method:
88
79
89
80
- A [URI Connection String ](https://docs.mongodb.org/manual/reference/connection-string/) that includes `ssl=true` setting,
90
81
91
-
- A connections options for the `server`with the `sslValidate` setting set to `true`, the certificate for the Certificate Authority (`sslCA`), the client's certificate (`sslCert`) and private key file (`sslKey`). If the client's key file is encrypted, include the password (`sslPass`).
82
+
- A connections options with the `sslValidate` setting set to `true`, the certificate for the Certificate Authority (`sslCA`), the client's certificate (`sslCert`) and private key file (`sslKey`). If the client's key file is encrypted, include the password (`sslPass`).
92
83
93
84
```js
94
85
var MongoClient =require('mongodb').MongoClient,
@@ -102,27 +93,23 @@ var key = fs.readFileSync(__dirname + "/ssl/client.pem");
102
93
103
94
// Connect validating the returned certificates from the server
[X.509](http://docs.mongodb.org/manual/core/authentication/#x-509-certificate-authentication) authentication requires the use of TLS/SSL connections with certificate validation. MongoDB uses the X.509 certificate presented during SSL negotiation to authenticate a user whose name is derived from the distinguished name of the X.509 certificate.
121
108
122
109
To connect using the X.509 authentication mechanism, specify `MONGODB-CR` as the mechanism in the [URI connection string](https://docs.mongodb.org/manual/reference/connection-string/), `ssl=true`, and the username. Use `enodeURIComponent` to encode the username string.
123
110
124
111
In addition to the connection string, pass to the `MongoClient.connect` method
125
-
a connections options for the `server`with the X.509 certificate and other [TLS/SSL connections]({{< relref "tutorials/connect/ssl.md" >}}) options.
112
+
a connections options with the X.509 certificate and other [TLS/SSL connections]({{< relref "reference/connecting/connection-settings.md" >}}) options.
126
113
127
114
```js
128
115
var MongoClient =require('mongodb').MongoClient,
@@ -139,14 +126,11 @@ var userName = "CN=client,OU=kerneluser,O=10Gen,L=New York City,ST=New York,C=US
139
126
// Connect using the MONGODB-X509 authentication mechanism
0 commit comments