-
Notifications
You must be signed in to change notification settings - Fork 550
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
Make sure ssl is enabled if only :sslverify is set #889
Conversation
Previously, when "sslverify: false/true" was the only ssl related options passed to the constructor, the module skipped the call to "mysql_ssl_set". It seems however that for some variants for the mysql client libraries calling "mysql_ssl_set" is the only way to enable SSL for the client connections. (E.g. the libraries shipped as part of mariadb 10.1 still lack support for MYSQL_OPT_SSL_ENFORCE and MYSQL_OPT_SSL_MODE) This change allows enabling ssl with default values for all other options by just passing "sslverify: true" or "sslverify: false" to the constructor. (Depending on whether server certificate verification is wanted or not)
Based on my reading of https://dev.mysql.com/doc/refman/5.7/en/mysql-ssl-set.html if all of the arguments to Based on https://dev.mysql.com/doc/refman/5.7/en/c-api-encrypted-connections.html the way to enforce SSL is to call |
This doesn't seem to be true for mariadb 10.1: Even if it's called with all arguments NULL it still sets
Unfortunately mariadb 10.1 (which AFAIK is still officially maintained) doesn't have those options. |
Makes sense now! Thanks for linking to the relevant line of code in the driver. |
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.
lgtm;
@sodabrew Hi. Is there any chance to get this merged? |
@@ -47,7 +47,7 @@ def initialize(opts = {}) | |||
self.charset_name = opts[:encoding] || 'utf8' | |||
|
|||
ssl_options = opts.values_at(:sslkey, :sslcert, :sslca, :sslcapath, :sslcipher) | |||
ssl_set(*ssl_options) if ssl_options.any? | |||
ssl_set(*ssl_options) if ssl_options.any? || opts.key?(:sslverify) |
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.
This will turn on ssl even if the only flag is sslverify: false
which doesn't quite make sense to me.
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 think given #879 that ssl_set
should be called if any value of :ssl_mode
is set, too.
Previously, when "sslverify: false/true" was the only ssl related
options passed to the constructor, the module skipped the call to
"mysql_ssl_set". It seems however that for some variants for the mysql
client libraries calling "mysql_ssl_set" is the only way to enable SSL
for the client connections. (E.g. the libraries shipped as part of
mariadb 10.1 still lack support for MYSQL_OPT_SSL_ENFORCE and
MYSQL_OPT_SSL_MODE)
This change allows enabling ssl with default values for all other
options by just passing "sslverify: true" or "sslverify: false" to the
constructor. (Depending on whether server certificate verification is
wanted or not)