@@ -119,9 +119,9 @@ The driver configuration:
119
119
.. code-block :: python
120
120
121
121
from cassandra.cluster import Cluster, Session
122
- from ssl import SSLContext, PROTOCOL_TLSv1
122
+ from ssl import SSLContext, PROTOCOL_TLS
123
123
124
- ssl_context = SSLContext(PROTOCOL_TLSv1 )
124
+ ssl_context = SSLContext(PROTOCOL_TLS )
125
125
126
126
cluster = Cluster([' 127.0.0.1' ], ssl_context = ssl_context)
127
127
session = cluster.connect()
@@ -147,9 +147,9 @@ to `CERT_REQUIRED`. Otherwise, the loaded verify certificate will have no effect
147
147
.. code-block :: python
148
148
149
149
from cassandra.cluster import Cluster, Session
150
- from ssl import SSLContext, PROTOCOL_TLSv1 , CERT_REQUIRED
150
+ from ssl import SSLContext, PROTOCOL_TLS , CERT_REQUIRED
151
151
152
- ssl_context = SSLContext(PROTOCOL_TLSv1 )
152
+ ssl_context = SSLContext(PROTOCOL_TLS )
153
153
ssl_context.load_verify_locations(' /path/to/rootca.crt' )
154
154
ssl_context.verify_mode = CERT_REQUIRED
155
155
@@ -161,9 +161,9 @@ Additionally, you can also force the driver to verify the `hostname` of the serv
161
161
.. code-block :: python
162
162
163
163
from cassandra.cluster import Cluster, Session
164
- from ssl import SSLContext, PROTOCOL_TLSv1 , CERT_REQUIRED
164
+ from ssl import SSLContext, PROTOCOL_TLS , CERT_REQUIRED
165
165
166
- ssl_context = SSLContext(PROTOCOL_TLSv1 )
166
+ ssl_context = SSLContext(PROTOCOL_TLS )
167
167
ssl_context.load_verify_locations(' /path/to/rootca.crt' )
168
168
ssl_context.verify_mode = CERT_REQUIRED
169
169
ssl_context.check_hostname = True
@@ -228,9 +228,9 @@ Finally, you can use that configuration with the following driver code:
228
228
.. code-block:: python
229
229
230
230
from cassandra.cluster import Cluster, Session
231
- from ssl import SSLContext, PROTOCOL_TLSv1
231
+ from ssl import SSLContext, PROTOCOL_TLS
232
232
233
- ssl_context = SSLContext(PROTOCOL_TLSv1 )
233
+ ssl_context = SSLContext(PROTOCOL_TLS )
234
234
ssl_context.load_cert_chain(
235
235
certfile='/path/to/client.crt_signed',
236
236
keyfile='/path/to/client.key')
@@ -251,9 +251,9 @@ The following driver code specifies that the connection should use two-way verif
251
251
.. code-block:: python
252
252
253
253
from cassandra.cluster import Cluster, Session
254
- from ssl import SSLContext, PROTOCOL_TLSv1 , CERT_REQUIRED
254
+ from ssl import SSLContext, PROTOCOL_TLS , CERT_REQUIRED
255
255
256
- ssl_context = SSLContext(PROTOCOL_TLSv1 )
256
+ ssl_context = SSLContext(PROTOCOL_TLS )
257
257
ssl_context.load_verify_locations('/path/to/rootca.crt')
258
258
ssl_context.verify_mode = CERT_REQUIRED
259
259
ssl_context.load_cert_chain(
@@ -275,7 +275,7 @@ for more details about ``SSLContext`` configuration.
275
275
from cassandra.cluster import Cluster
276
276
from cassandra.io.twistedreactor import TwistedConnection
277
277
278
- ssl_context = SSL.Context(SSL.TLSv1_METHOD )
278
+ ssl_context = SSL.Context(SSL.TLSv1_2_METHOD )
279
279
ssl_context.set_verify(SSL.VERIFY_PEER, callback=lambda _1, _2, _3, _4, ok: ok)
280
280
ssl_context.use_certificate_file('/path/to/client.crt_signed')
281
281
ssl_context.use_privatekey_file('/path/to/client.key')
@@ -303,19 +303,19 @@ deprecated in the next major release.
303
303
304
304
By default, a ` ` ca_certs` ` value should be supplied (the value should be
305
305
a string pointing to the location of the CA certs file), and you probably
306
- want to specify ` ` ssl_version` ` as ` ` ssl.PROTOCOL_TLSv1 ` ` to match
306
+ want to specify ` ` ssl_version` ` as ` ` ssl.PROTOCOL_TLS ` ` to match
307
307
Cassandra's default protocol.
308
308
309
309
For example:
310
310
311
311
.. code-block:: python
312
312
313
313
from cassandra.cluster import Cluster
314
- from ssl import PROTOCOL_TLSv1 , CERT_REQUIRED
314
+ from ssl import PROTOCOL_TLS , CERT_REQUIRED
315
315
316
316
ssl_opts = {
317
317
'ca_certs': '/path/to/my/ca.certs',
318
- 'ssl_version': PROTOCOL_TLSv1 ,
318
+ 'ssl_version': PROTOCOL_TLS ,
319
319
'cert_reqs': CERT_REQUIRED # Certificates are required and validated
320
320
}
321
321
cluster = Cluster(ssl_options=ssl_opts)
0 commit comments