-
Notifications
You must be signed in to change notification settings - Fork 441
Added to pass ssl_mode in configuration. #347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ Coverage Diff @@
## master #347 +/- ##
==========================================
+ Coverage 87.14% 87.18% +0.04%
==========================================
Files 13 14 +1
Lines 1556 1561 +5
==========================================
+ Hits 1356 1361 +5
Misses 200 200
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #347 +/- ##
==========================================
+ Coverage 86.61% 86.75% +0.14%
==========================================
Files 12 12
Lines 1531 1533 +2
==========================================
+ Hits 1326 1330 +4
+ Misses 205 203 -2
Continue to review full report at Codecov.
|
I think there is no MYSQL_OPT_SSL_MODE in old MySQL Connector/C or MariaDB. |
MYSQL_OPT_SSL_MODE exists from MySQL5.5.55. |
MySQL 5.5+ are supported. |
I used MYSQL_DEFAULT_AUTH which is introduced in MySQL 5.5.10. (see #396) I wll drop Python 2 support. So I am OK to drop some old MySQL support. |
I see. |
… MYSQL_OPT_SSL_MODE is defined
The version in which MYSQL_OPT_SSL_MODE is defined MYSQL_OPT_SSL_MODE was found to be not defined in MariaDB. |
Options should be similar to |
It has modified |
I don't like this. This implementation ignores the ssl_mode option silently when it is not supported by the underlying library. There are two options to fix this:
|
I see. |
MySQLdb/_mysql.c
Outdated
(PyCFunction)_mysql_get_have_enum_mysql_opt_ssl_mode, | ||
METH_NOARGS, | ||
_mysql_get_have_enum_mysql_opt_ssl_mode__doc__ | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't add new API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see.
MySQLdb/connections.py
Outdated
@@ -102,6 +102,13 @@ class object, used to create cursors (keyword only) | |||
:param int client_flag: | |||
flags to use or 0 (see MySQL docs or constants/CLIENTS.py) | |||
|
|||
:param str ssl_mode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:param str ssl_mode | |
:param str ssl_mode: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
MySQLdb/connections.py
Outdated
if 'ssl_mode' in kwargs: | ||
if not _mysql.get_have_enum_mysql_opt_ssl_mode(): | ||
raise NotSupportedError('Does not support ssl_mode specification: %s' % _mysql.get_client_info()) | ||
if hasattr(SSL_MODE, kwargs['ssl_mode']): | ||
kwargs2['ssl_mode'] = getattr(SSL_MODE, kwargs['ssl_mode']) | ||
else: | ||
raise NotSupportedError('Unknown MySQL ssl_mode specification: %s' % kwargs['ssl_mode']) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implement this block in C.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented error checking on the C lang side.
And removed MySQLdb.constants.SSL_MODE, which is no longer needed.
Thanks! |
SSL was enabled by default when connecting to MySQL 5.7.
See https://dev.mysql.com/worklog/task/?id=7712
Added to configuration to enable/disable SSL.
The reason for not using --ssl or --skip-ssl described in MySQL Worklog, --ssl option is deprecated as of MySQL 5.7.11.
See https://dev.mysql.com/doc/refman/5.7/en/encrypted-connection-options.html