10000 Implement SslMode=preferred by caleblloyd · Pull Request #158 · mysql-net/MySqlConnector · GitHub
[go: up one dir, main page]

Skip to content

Implement SslMode=preferred #158

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

Merged
merged 1 commit into from
Jan 12, 2017
Merged

Conversation

caleblloyd
Copy link
Contributor
  • Fixes Support SSL without Client Certificates and add SslMode=preferred #157
  • Adds SslMode=preferred as default functionality for SslMode (this now matches Oracle's connector)
  • Allows for SSL connection without client certs
  • Adds test cases for:
    • SslMode=preferred
    • Good client cert (signed by same CA as server's ssl-ca)
    • Bad client cert (signed by different CA than server's ssl-ca)

@caleblloyd caleblloyd force-pushed the f_ssl_preferred branch 2 times, most recently from 2702824 to 98725bb Compare January 11, 2017 18:23
/// Do not use SSL. This is the default.
/// Use SSL if the server supports it. This is the default.
/// </summary>
Preferred,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should keep the same order as https://github.com/mysql/mysql-connector-net/blob/5864e6b21a8b32f5154b53d1610278abb3cb1cee/Source/MySql.Data/MysqlDefs.cs#L363 so that default(MySqlSslMode) is the same (source compatibility). (Even though that's not the same default that the connector would actually use.)

@@ -87,8 +87,13 @@ public MySqlSession(ConnectionPool pool, int poolGeneration)
if (cs.UseCompression && (initialHandshake.ProtocolCapabilities & ProtocolCapabilities.Compress) == 0)
cs = cs.WithUseCompression(false);

if (cs.SslMode != MySqlSslMode.None)
var serverSupporsSsl = (initialHandshake.ProtocolCapabilities & ProtocolCapabilities.Ssl) != 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: Supports

@caleblloyd caleblloyd force-pushed the f_ssl_preferred branch 2 times, most recently from 8c96885 to 3caec34 Compare January 11, 2017 19:12
@caleblloyd
Copy link
Contributor Author

We should keep the same order as https://github.com/mysql/mysql-connector-net/blob/5864e6b21a8b32f5154b53d1610278abb3cb1cee/Source/MySql.Data/MysqlDefs.cs#L363

I changed the order to match. I left out the Prefered=Preferred alias. I guess this would help with misspelling, but it also makes MySqlSslMode.Prefered the first auto-suggested ENUM in my IDE, which is going to promote misspelling.

I don't think that Aliases count as an integer value for enumerations, so the integer values should still match up without it.

@caleblloyd
Copy link
Contributor Author

I ran SideBySide.Baseline tests with SSL. MySql.Data has an issue reading client certs from our default path (maybe the . in .ci is causing an issue for them?), but once I move them out to a different path the Baseline tests pass.

@bgrainger bgrainger merged commit 2830865 into mysql-net:master Jan 12, 2017
@bgrainger
Copy link
Member

Shipped in 0.11.0.

@caleblloyd caleblloyd deleted the f_ssl_preferred branch February 7, 2017 02:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0