Cannot open SSL connection to MySql server from .NET client

This is a discussion on Cannot open SSL connection to MySql server from .NET client within the MySQL Database forums, part of the Database Forums category; I am attempting to improve the internal security at our company by requiring SSL connections to our MySql database from ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-05-2008
john22233328@yahoo.com
 
Posts: n/a
Default Cannot open SSL connection to MySql server from .NET client

I am attempting to improve the internal security at our company by
requiring
SSL connections to our MySql database from ASP.Net. I have set up the
MySql server to use OpenSSL, but when I attempt to make a connection
from
the client, I get the error:

"Lost connection to MySQL server during query"

This error occurs immediately (it is not as though it timed out).

I have done various searches on this site, Google, etc and have not
found
the solution.


The MySql (Linux) server is set up as follows:

1. Created certificates in /d1/mysql/Certificates using the openssl
command as specified at http://dev.mysql.com/doc/refman/5.0/...te-certs.html:

cacert.pem
client-cert.pem
client-key.pem

2. In the /etc/my.cnf file, added the following to the [mysqld]
section:

ssl-ca=/d1/mysql/Certificates/cacert.pem
ssl-cert=/d1/mysql/Certificates/server-cert.pem
ssl-key=/d1/mysql/Certificates/server-key.pem

3. In the /etc/my.cnf file, added the following to the [client]
section:

ssl-ca=/d1/mysql/Certificates/cacert.pem
ssl-cert=/d1/mysql/Certificates/client-cert.pem
ssl-key=/d1/mysql/Certificates/client-key.pem

4. Restarted the MySql server.

Now, when I do a SHOW VARIABLES LIKE '%ssl%', I get:

Variable_name Value
have_openssl YES
have_ssl YES
ssl_ca /d1/mysql/Certificates/cacert.pem
ssl_capath ""
ssl_cert /d1/mysql/Certificates/server-cert.pem
ssl_cipher ""
ssl_key /d1/mysql/Certificates/server-key.pem


The (WinXP) client attempts to connect to the server as follows:

1. Copy the certificate and keys to the C:\junk5 folder on the client:

ca-cert.pem
client-cert.pem
client-key.pem

2. Add the following code to my C# .NET program:

MySqlConnection connection = new MySqlConnection();

connection.ConnectionString = "server=10.1.1.111;user id=myuser;
password=mypassword; database=MyDatabase; pooling=true;Protocol=SSL;";

connection.SslOptions.CACert = "file://C:\\junk5\\ca-cert.pem";
connection.SslOptions.Cert = "file://C:\\junk5\\client-cert.pem";
connection.SslOptions.Key = "file://C:\\junk5\\client-key.pem";
connection.Open();


As soon as an attempt is made to open the connection, the error

"Lost connection to MySQL server during query"

occurs. This works if I exclude setting the SslOptions and the
"Protocol=SSL;" in
the connection string.


I have opened the permissions on the certificate and key files on both
the
server and client.

Also, I am using version 5.0.41-community-log of MySql with
CoreLab MyDirect .NET for .NET 2 Professsional (DLLs are V4.30.20).


Does anyone have any idea why this does not work?

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 10:05 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0