@@ -77,14 +77,14 @@ Basic configuration
77
77
...................
78
78
79
79
In many cases connecting to MongoDB over TLS/SSL requires nothing more than
80
- passing ``ssl =True `` as a keyword argument to
80
+ passing ``tls =True `` as a keyword argument to
81
81
:class: `~pymongo.mongo_client.MongoClient `::
82
82
83
- >>> client = pymongo.MongoClient('example.com', ssl =True)
83
+ >>> client = pymongo.MongoClient('example.com', tls =True)
84
84
85
- Or passing ``ssl =true `` in the URI::
85
+ Or passing ``tls =true `` in the URI::
86
86
87
- >>> client = pymongo.MongoClient('mongodb://example.com/?ssl =true')
87
+ >>> client = pymongo.MongoClient('mongodb://example.com/?tls =true')
88
88
89
89
This configures PyMongo to connect to the server using TLS, verify the server's
90
90
certificate and verify that the host you are attempting to connect to is listed
@@ -94,17 +94,17 @@ Certificate verification policy
94
94
...............................
95
95
96
96
By default, PyMongo is configured to require a certificate from the server when
97
- TLS is enabled. This is configurable using the `ssl_cert_reqs ` option. To
98
- disable this requirement pass ``ssl.CERT_NONE `` as a keyword parameter::
97
+ TLS is enabled. This is configurable using the ``tlsAllowInvalidCertificates ``
98
+ option. To disable this requirement pass ``tlsAllowInvalidCertificates=True ``
99
+ as a keyword parameter::
99
100
100
- >>> import ssl
101
101
>>> client = pymongo.MongoClient('example.com',
102
- ... ssl =True,
103
- ... ssl_cert_reqs=ssl.CERT_NONE )
102
+ ... tls =True,
103
+ ... tlsAllowInvalidCertificates=True )
104
104
105
105
Or, in the URI::
106
106
107
- >>> uri = 'mongodb://example.com/?ssl =true&ssl_cert_reqs=CERT_NONE '
107
+ >>> uri = 'mongodb://example.com/?tls =true&tlsAllowInvalidCertificates=true '
108
108
>>> client = pymongo.MongoClient(uri)
109
109
110
110
Specifying a CA file
@@ -113,32 +113,32 @@ Specifying a CA file
113
113
In some cases you may want to configure PyMongo to use a specific set of CA
114
114
certificates. This is most often the case when you are acting as your own
115
115
certificate authority rather than using server certificates signed by a well
116
- known authority. The `ssl_ca_certs ` option takes a path to a CA file. It can be
116
+ known authority. The `` tlsCAFile ` ` option takes a path to a CA file. It can be
117
117
passed as a keyword argument::
118
118
119
119
>>> client = pymongo.MongoClient('example.com',
120
- ... ssl =True,
121
- ... ssl_ca_certs ='/path/to/ca.pem')
120
+ ... tls =True,
121
+ ... tlsCAFile ='/path/to/ca.pem')
122
122
123
123
Or, in the URI::
124
124
125
- >>> uri = 'mongodb://example.com/?ssl =true&ssl_ca_certs =/path/to/ca.pem'
125
+ >>> uri = 'mongodb://example.com/?tls =true&tlsCAFile =/path/to/ca.pem'
126
126
>>> client = pymongo.MongoClient(uri)
127
127
128
128
Specifying a certificate revocation list
129
129
........................................
130
130
131
131
Python 2.7.9+ (pypy 2.5.1+) and 3.4+ provide support for certificate revocation
132
- lists. The `ssl_crlfile ` option takes a path to a CRL file. It can be passed as
133
- a keyword argument::
132
+ lists. The `` tlsCRLFile `` option takes a path to a CRL file. It can be passed
133
+ as a keyword argument::
134
134
135
135
>>> client = pymongo.MongoClient('example.com',
136
- ... ssl =True,
137
- ... ssl_crlfile ='/path/to/crl.pem')
136
+ ... tls =True,
137
+ ... tlsCRLFile ='/path/to/crl.pem')
138
138
139
139
Or, in the URI::
140
140
141
- >>> uri = 'mongodb://example.com/?ssl =true&ssl_crlfile =/path/to/crl.pem'
141
+ >>> uri = 'mongodb://example.com/?tls =true&tlsCRLFile =/path/to/crl.pem'
142
142
>>> client = pymongo.MongoClient(uri)
143
143
144
144
.. note :: Certificate revocation lists and :ref:`OCSP` cannot be used together.
@@ -147,28 +147,29 @@ Client certificates
147
147
...................
148
148
149
149
PyMongo can be configured to present a client certificate using the
150
- `ssl_certfile ` option::
150
+ `` tlsCertificateKeyFile ` ` option::
151
151
152
152
>>> client = pymongo.MongoClient('example.com',
153
- ... ssl =True,
154
- ... ssl_certfile ='/path/to/client.pem')
153
+ ... tls =True,
154
+ ... tlsCertificateKeyFile ='/path/to/client.pem')
155
155
156
156
If the private key for the client certificate is stored in a separate file use
157
- the `ssl_keyfile ` option::
157
+ the `` ssl_keyfile ` ` option::
158
158
159
159
>>> client = pymongo.MongoClient('example.com',
160
- ... ssl =True,
161
- ... ssl_certfile ='/path/to/client.pem',
160
+ ... tls =True,
161
+ ... tlsCertificateKeyFile ='/path/to/client.pem',
162
162
... ssl_keyfile='/path/to/key.pem')
163
163
164
164
Python 2.7.9+ (pypy 2.5.1+) and 3.3+ support providing a password or passphrase
165
- to decrypt encrypted private keys. Use the `ssl_pem_passphrase ` option::
165
+ to decrypt encrypted private keys. Use the ``tlsCertificateKeyFilePassword ``
166
+ option::
166
167
167
168
>>> client = pymongo.MongoClient('example.com',
168
- ... ssl =True,
169
- ... ssl_certfile ='/path/to/client.pem',
169
+ ... tls =True,
170
+ ... tlsCertificateKeyFile ='/path/to/client.pem',
170
171
... ssl_keyfile='/path/to/key.pem',
171
- ... ssl_pem_passphrase =<passphrase>)
172
+ ... tlsCertificateKeyFilePassword =<passphrase>)
172
173
173
174
174
175
These options can also be passed as part of the MongoDB URI.
0 commit comments