Skip to content

Commit b852e2d

Browse files
committed
WL12738: Specify TLS ciphers - Docs change
1 parent 33689c9 commit b852e2d

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

docs/mysqlx/tutorials/getting_started.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,3 +209,31 @@ For instance, given the following SRV records by a DNS server at the ``foo.abc.c
209209
_mysqlx._tcp.foo.abc.com. 86400 IN SRV 10 5 33060 foo3.abc.com
210210
_mysqlx._tcp.foo.abc.com. 86400 IN SRV 20 5 33060 foo4.abc.com
211211

212+
Specifying which TLS versions to use
213+
------------------------------------
214+
215+
The desired TLS versions to use during the connection van be specified while getting the session with the use of ``tls-versions`` option and in addition the TLS ciphers can also be specified with the ``tls-ciphersuites`` option.
216+
217+
.. code-block:: python
218+
219+
session = mysqlx.get_session('mysqlx://root:@127.0.0.1:33060?tls-versions=[TLSv1.1,TLSv1.2]&tls-ciphersuites=[DHE-RSA-AES256-SHA]&ssl-mode=required')
220+
# or
221+
session = mysqlx.get_session({
222+
'host': '127.0.0.1',
223+
'user': 'root',
224+
'password': '',
225+
'tls-versions"': ["TLSv1.1", "TLSv1.2"],
226+
'tls-ciphersuites': ["DHE-RSA-AES256-SHA"],
227+
})
228+
res = session.sql("SHOW STATUS LIKE 'Mysqlx_ssl_version'").execute().fetch_all()
229+
print("Mysqlx_ssl_version: {}".format(res[0].get_string('Value')))
230+
res = session.sql("SHOW STATUS LIKE 'Mysqlx_ssl_cipher'").execute().fetch_all()
231+
print("Mysqlx_ssl_cipher: {}".format(res[0].get_string('Value')))
232+
session.close()
233+
234+
From the given list of TLS versions, the highest supported version will be selected for the connection, given as result:
235+
236+
Mysqlx_ssl_version: TLSv1.2
237+
238+
Mysqlx_ssl_cipher: DHE-RSA-AES256-SHA
239+

0 commit comments

Comments
 (0)