diff options
author | Paul Tiplady <paultiplady@users.noreply.github.com> | 2017-06-19 15:11:25 -0700 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2017-06-19 18:11:25 -0400 |
commit | 335a8d7895a0d73df3d41fac750ff8f412a989b2 (patch) | |
tree | 84cecf2b803605ff756194b457ce112165d8a2d0 /django/db/backends/mysql/client.py | |
parent | a469e158a983e7c358dddb9e0e43f5f4423031c9 (diff) | |
download | django-335a8d7895a0d73df3d41fac750ff8f412a989b2.tar.gz |
Fixed #28322 -- Added dbshell support for MySQL client TLS certs.
Diffstat (limited to 'django/db/backends/mysql/client.py')
-rw-r--r-- | django/db/backends/mysql/client.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/django/db/backends/mysql/client.py b/django/db/backends/mysql/client.py index c5cc69c3a0..224bfc3dc6 100644 --- a/django/db/backends/mysql/client.py +++ b/django/db/backends/mysql/client.py @@ -14,7 +14,9 @@ class DatabaseClient(BaseDatabaseClient): passwd = settings_dict['OPTIONS'].get('passwd', settings_dict['PASSWORD']) host = settings_dict['OPTIONS'].get('host', settings_dict['HOST']) port = settings_dict['OPTIONS'].get('port', settings_dict['PORT']) - cert = settings_dict['OPTIONS'].get('ssl', {}).get('ca') + server_ca = settings_dict['OPTIONS'].get('ssl', {}).get('ca') + client_cert = settings_dict['OPTIONS'].get('ssl', {}).get('cert') + client_key = settings_dict['OPTIONS'].get('ssl', {}).get('key') defaults_file = settings_dict['OPTIONS'].get('read_default_file') # Seems to be no good way to set sql_mode with CLI. @@ -31,8 +33,12 @@ class DatabaseClient(BaseDatabaseClient): args += ["--host=%s" % host] if port: args += ["--port=%s" % port] - if cert: - args += ["--ssl-ca=%s" % cert] + if server_ca: + args += ["--ssl-ca=%s" % server_ca] + if client_cert: + args += ["--ssl-cert=%s" % client_cert] + if client_key: + args += ["--ssl-key=%s" % client_key] if db: args += [db] return args |