vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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? |