[MDEV-4709] MariaDB SSL connection issues Created: 2013-06-25 Updated: 2013-08-09 Resolved: 2013-06-27 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 5.5.31 |
| Fix Version/s: | 5.5.32 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Catalin Stefanescu (Inactive) | Assignee: | Sergei Golubchik |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Debian squeeze 64 bit, packages from official MariaDB repositories |
||
| Description |
|
Hi, After switching from Mysql to MariaDB ( Server version: 5.5.31-MariaDB-1squeeze-log ) we lost the ability to connect via SSL to the server. We were using self signed certificates generated via the method described here and they worked well before the switch to MariaDB : http://dev.mysql.com/doc/refman/5.5/en/creating-ssl-certs.html We get the following error messages when trying to connect on the same machine having both the client and the server.
Thanks. |
| Comments |
| Comment by Elena Stepanova [ 2013-06-25 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi, Could you please provide the output of and from MySQL client Also, do you remember how long ago / on what system / with what openssl version your certs were generated? And which MySQL 5.1 minor version did you use last before upgrading to MariaDB 5.5? Thanks. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Catalin Stefanescu (Inactive) [ 2013-06-26 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi, Thank you for your reply. ldd /usr/sbin/mysqld ldd /usr/bin/mysql lsof | grep ssl | grep mysqld MariaDB [(none)]> SHOW STATUS LIKE '%ssl%';
-------------------------------
------------------------------- SHOW VARIABLES LIKE '%ssl%';
--------------
-------------- The original certificates were generated in January. The MySQL version was 5.1.66 from Debian Thanks. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2013-06-26 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Catalin,
Could you please also run Thanks. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Catalin Stefanescu (Inactive) [ 2013-06-26 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi, I used example 1. mysql -v -u user -p database --ssl-ca /etc/mysql/newcerts/ca-cert.pem --ssl-cert /etc/mysql/newcerts/client-cert.pem --ssl-key /etc/mysql/newcerts/client-key.pem openssl verify -CAfile /etc/mysql/newcerts/ca-cert.pem /etc/mysql/newcerts/server-cert.pem /etc/mysql/newcerts/client-cert.pem ls -l /etc/mysql/newcerts/*.pem
Thanks | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2013-06-26 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Interesting, I don't think it's supposed to give "error 18 at ...". I'll re-do it through Example 1 and will get back to you. Maybe there is something with the keys that MySQL tolerates but MariaDB doesn't... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2013-06-26 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Thank you, I was able to reproduce the problem with keys created using the information you provided – the keys work with MySQL 5.1.66, but do not work 5.5.31. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2013-06-26 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Catalin, I ran some tests and got something that you might try as (at least) a workaround. The errors ("error 18 at 0 depth...") make me suppose that when you were creating the certs, you used the exact same info for each of CA certificate, server certificate and client certificate. That's when the error pops up; and that's what causes MariaDB to reject the connection later when these certificates are used. It seems important that at least one field in CA certificate differs from the field in the server and client certificates (information in the latter two can be identical). I was experimenting with Locality Name field, I suppose others can be used as well, but I didn't check. Could you please try the following (I will use the information you pasted above, if you obfuscated it, please feel free to modify accordingly, but preserve the difference that I highlight): Execute the cert creation procedure again; First time when you are asked for Country / State / Locality /Organisation etc., enter Second and third time when you are asked for Country / State / Locality / Organisation etc., enter Make sure that on the last step, during verification, you got "OK" for both certs, without "error 18 at 0...". After that, restart MariaDB server using the new certificates and try to connect to it, also using the new certificates. My guess (not confirmed yet) with yaSSL, which MySQL 5.1 on Debian is using, this error is ignored, while with OpenSSL which is used by MariaDB 5.5, it's checked and thus causes the connection reject. I don't know yet if the difference is inside the libraries themselves or is on the mysql server level, it is something to figure out, we'll keep investigating it. Chances are that the new behavior is actually correct, since openssl itself says that the certificates are erroneous and cannot be trusted. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Catalin Stefanescu (Inactive) [ 2013-06-27 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Elena, Thank you for your help. openssl verify -CAfile /etc/mysql/newcerts/ca-cert.pem /etc/mysql/newcerts/server-cert.pem /etc/mysql/newcerts/client-cert.pem Thanks again for your support. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2013-06-27 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Sergei, Passing it to you for a verdict. MariaDB using openssl library refuses to connect with such certificates. MySQL (and I suppose MariaDB) using yaSSL allows to connect all right. On one hand, it looks like openssl-based builds behave in a more correct way since the library itself thinks that the certificates are not trustworthy. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2013-06-27 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I'd say it's not a bug. One can use SSL certificates. The command-line openssl complains that they are invalid. It's logical to expect that they won't work. In this case it's not our random decision, but a standard SSL verification tool that rejects them. One could even argue that it was a bug that invalid certificated worked at all. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2013-06-27 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
An additional note for those who might have found this issue while looking up the problem. There is also Percona bug report https://bugs.launchpad.net/percona-server/+bug/1169505, currently there is a user who says they are not getting an error on openssl verify, but still can't connect using the certificates after upgrade from one Percona version to another. It's hard to say whether it's a user error or a different problem. If you observe similar behavior on a MariaDB version (no errors on openssl verify, but can't connect), please leave a comment with any information you can provide (see the previous discussion here for the hints what might be useful). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sam Wilson [ 2013-08-09 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I was having the same problem and this workaround fixed it for me. One added difficulty in my case was that I had an invalid path specified in my.cnf for the `ssl-ca` setting and it was returning the same exact error code/message. Once I fixed that and then applied this workaround, everything worked just fine. I'm on CentOS 5.8, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008, and mysql 5.5.27 Please don't mind the older versions of everything, I'm in the process of migrating off of this server by end of month. Thank you very much for the fix/workaround. |