我希望我的网络服务器通过 SSL 连接与 MySQL 数据库服务器通话。Web 服务器运行 CentOS5,数据库服务器运行 FreeBSD。证书由中间 CA DigiCert 提供。
MySQL 应该使用 ssl,根据my.cnf:
# The MySQL server
[mysqld]
port = 3306
socket = /tmp/mysql.sock
ssl
ssl-capath = /opt/mysql/pki/CA
ssl-cert = /opt/mysql/pki/server-cert.pem
ssl-key = /opt/mysql/pki/server-key.pem
Run Code Online (Sandbox Code Playgroud)
当我启动 MySQL 时,守护进程启动时没有错误。这表明证书文件都是可读的。
但是当我尝试从网络服务器连接到数据库服务器时,出现错误:
[root@webserver ~]# mysql -h mysql.example.org -u user -p
ERROR 2026 (HY000): SSL connection error
Run Code Online (Sandbox Code Playgroud)
如果我尝试使用 openssl 进一步调试:
[root@webserver ~]# openssl s_client -connect mysql.example.org:3306 0>/dev/null
CONNECTED(00000003)
15706:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:s23_clnt.c:588:
Run Code Online (Sandbox Code Playgroud)
这是测试与 MySQL 数据库服务器的 SSL 连接的有效方法吗?该SSL23_GET_SERVER_HELLO:unknown protocol消息很奇怪,因为这通常是您在用于非 SSL 流量的端口上使用 SSL …