2015-02-24 16 views
7

MySQL ile çalışıyorum ve SSL'yi etkinleştirmek için MySQL ile kullanılacak sertifikaları üretiyorum. İşte SSL üzerinden MySQL'e bağlanma hakkında ERROR 2026 (HY000): SSL bağlantı hatası: protokol sürümü uyuşmazlığı

SSL yapılandırmaları şunlardır:

mysql> show variables like '%ssl%'; 
+---------------+----------------------------+ 
| Variable_name | Value      | 
+---------------+----------------------------+ 
| have_openssl | YES      | 
| have_ssl  | YES      | 
| ssl_ca  | /etc/mysql/ca-cert.pem  | 
| ssl_capath |       | 
| ssl_cert  | /etc/mysql/server-cert.pem | 
| ssl_cipher |       | 
| ssl_key  | /etc/mysql/server-key.pem | 
+---------------+----------------------------+ 
7 rows in set (0.00 sec) 

Bu iyi çalışıyor gibi görünüyor ve ben MySQL sunucusu ile sertifikalarını uygulayarak iyi yapmış gibi görünüyor.

Sorun, uzak ana bilgisayar üzerinden MySQL sunucusuna bağlantı oluştururken var.

mysql -u app1 -p -h 192.168.33.131 --ssl --ssl-capath=<path>/ssl/ --ssl-ca=<path>/ca-cert.pem --ssl-cert=<path>/client-cert.pem --ssl-key=<path>/client-key.pem 
Enter password: 
ERROR 2026 (HY000): SSL connection error: protocol version mismatch 

Sertifikalarla ilgili bazı sorunlar yaşıyor gibi görünüyor veya başka bir şey olabilir.

Çevre: En altta

OS:  Ubuntu 14.04 
    MySQL: 5.5.41 
    OpenSSL: OpenSSL 1.0.1f 6 Jan 2014 
+0

http://askubuntu.com/questions/194074/ http: //www.percona. com/blog/2012/11/08/debugging-mysql-ssl-problems/https://bugs.mysql.com/bug.php?id=64870 – RandomSeed

+3

Yığın taşması programlama ve geliştirme için bir sitedir. sorular. Bu soru konu dışı görünmektedir, çünkü programlama veya geliştirme ile ilgili değildir. Yardım Merkezi’ndeki [http://stackoverflow.com/help/on-topic] adresine buradan [Hangi konuları sorabilirim?] Bölümüne bakın. Belki de [Süper Kullanıcı] (http://superuser.com/) veya [Veritabanı Yöneticileri Yığın Değişimi] (http://dba.stackexchange.com/) sorulacak daha iyi bir yer olabilir. Ayrıca bkz. [Dev Ops hakkında soruları nereye gönderebilirim?] (Http://meta.stackexchange.com/q/134306). – jww

cevap

3

https://bugs.mysql.com/bug.php?id=64870

:

If you're using 'openssl req -newkey rsa:2048 ...' to generate keys, please be advised that openssl 1.0 and newer now stores private keys in the PKCS#8 format instead of PKCS#1.

Make PKCS#8 the default write format for private keys, replacing the traditional format. This form is standardised, more secure and doesn't include an implicit MD5 dependency. [Steve Henson]

These keys will have a PEM header such as:

-----BEGIN PRIVATE KEY----- 

If MySQL is compiled with YaSSL as its SSL implementation (which I believe is the default), these keys won't load and MySQL will complain at startup: [Warning] Failed to setup SSL [Warning] SSL error: Unable to get private key

YaSSL expects RSA private keys in the PKCS#1 format, with the PEM header:

-----BEGIN RSA PRIVATE KEY----- 

Various "advices" online seem to suggest that you can change the PEM header and footer of those PKCS#8 private keys to get them to work with MySQL/yaSSL. That will indeed stop MySQL from complaining at startup, but unfortunately SSL connections against MySQL will still fail with something like:

**ERROR 2026 (HY000): SSL connection error: protocol version mismatch** 

To fix this, convert the key to the older PKCS#1 RSAPrivateKey format using 'openssl rsa'. $ openssl rsa -in key-from-openssl-1.pem -out pkcs1-yassl-compatible-key.pem