我正在尝试为
MySQL启用SSL连接 – SSL将在MysqL中显示为启用,但由于此错误,我无法建立任何连接:ERROR 2026(HY000):SSL连接错误:ASN:其他签名确认错误
我正在运行以下内容:
Ubuntu Version: 14.04.1 LTS (GNU/Linux 3.13.0-34-generic x86_64) MysqL Version: 5.5.38-0ubuntu0.14.04.1 OpenSSL Version: OpenSSL 1.0.1f 6 Jan 2014
我使用这些命令生成我的证书(所有在/ etc / MysqL中生成):
openssl genrsa -out ca-key.pem 2048 openssl req -new -x509 -nodes -days 3650 -key ca-key.pem -out ca-cert.pem -subj "/C=US/ST=NY/O=MyCompany/CN=ca" openssl req -newkey rsa:2048 -nodes -days 3650 -keyout server-key.pem -out server-req.pem -subj "/C=US/ST=NY/O=MyCompany/CN=server" openssl rsa -in server-key.pem -out server-key.pem openssl x509 -req -in server-req.pem -CA ca-cert.pem -CAkey ca-key.pem -set_serial 01 -out server-cert.pem openssl req -newkey rsa:2048 -nodes -days 3650 -keyout client-key.pem -out client-req.pem -subj "/C=US/ST=NY/O=MyCompany/CN=client" openssl rsa -in client-key.pem -out client-key.pem openssl x509 -req -in client-req.pem -CA ca-cert.pem -CAkey ca-key.pem -set_serial 01 -out client-cert.pem
我把以下内容放在my.cnf中:
[MysqLd] ssl-ca=/etc/MysqL/ca-cert.pem ssl-cert=/etc/MysqL/server-cert.pem ssl-key=/etc/MysqL/server-key.pem
当我尝试连接指定客户端证书时 – 我收到以下错误:
MysqL -uroot -ppassword --ssl-ca=/etc/MysqL/ca-cert.pem --ssl-cert=/etc/MysqL/client-cert.pem --ssl-key=/etc/MysqL/client-key.pem ERROR 2026 (HY000): SSL connection error: ASN: bad other signature confirmation
如果我没有SSL连接,我可以看到MysqL已正确加载证书:
MysqL -uroot -ppassword --ssl=false 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)
我生成的证书通过了OpenSSL验证和模数:
openssl verify -CAfile ca-cert.pem server-cert.pem client-cert.pem server-cert.pem: OK client-cert.pem: OK
我错过了什么?我以前在不同的服务器上使用过相同的过程并且它工作 – 但是Ubuntu版本是12.04 LTS而OpenSSL版本更旧(不记得具体).最新的OpenSSL有什么变化吗?
任何帮助,将不胜感激!
我用了:
# Generate a CA key and certificate with SHA1 digest openssl genrsa 2048 > ca-key.pem; openssl req -sha1 -new -x509 -nodes -days 3650 -key ca-key.pem > ca-cert.pem; # Create server key and certficate with SHA1 digest,sign it and convert # the RSA key from PKCS #8 (OpenSSL 1.0 and newer) to the old PKCS #1 format openssl req -sha1 -newkey rsa:2048 -days 3650 -nodes -keyout server-key.pem > server-req.pem; openssl x509 -sha1 -req -in server-req.pem -days 3650 -CA ca-cert.pem -CAkey ca-key.pem -set_serial 01 > server-cert.pem; openssl rsa -in server-key.pem -out server-key.pem; # Create client key and certificate with SHA digest,sign it and convert # the RSA key from PKCS #8 (OpenSSL 1.0 and newer) to the old PKCS #1 format openssl req -sha1 -newkey rsa:2048 -days 3650 -nodes -keyout client-key.pem > client-req.pem; openssl x509 -sha1 -req -in client-req.pem -days 3650 -CA ca-cert.pem -CAkey ca-key.pem -set_serial 01 > client-cert.pem; openssl rsa -in client-key.pem -out client-key.pem;
设置我的ssl(ubuntu 12.04).我的MysqL配置包含:
[client] ssl-cert=/etc/MysqL/client-cert.pem ssl-key=/etc/MysqL/client-key.pem [MysqLd] ssl-ca=/etc/MysqL/ca-cert.pem ssl-cert=/etc/MysqL/server-cert.pem ssl-key=/etc/MysqL/server-key.pem
看看this post调试ssl.和this post for openssl的变化(ubuntu 10.04 – > 14.04).