Google Cloud SQL SSL fails peer certificate validation

丶灬走出姿态 提交于 2019-12-01 08:13:22

Try connecting through the proxy if you have second generation sql, you might be able to connect pdo via the proxy with 127.0.0.1: https://cloud.google.com/sql/docs/compute-engine-access#gce-connect-proxy

Assuming you can convince MySQL that the hostname is should verify is in fact project-name:instance-id then I would have thought the hostname validation ought to succeed (though I agree that cert doesn't look great).

I tried the following from my Mac OS X workstation and it appeared to succeed, at least when using the mysql binary (I didn't try via PHP).

First I added a hosts entry on my machine included the colon as part of the name:

1.2.3.4   project-name:instance-id

After doing so I was able to connect successfully with the mysql (5.6.32) installed on my machine:

mysql -uroot -h "project-name:instance-id" --password \
    --ssl \
    --ssl-ca ~/Downloads/server-ca.pem \
    --ssl-cert ~/Downloads/client-cert.pem \
    --ssl-key ~/Downloads/client-key.pem \
    --ssl-verify-server-cert

(When I ran that same command with the IP address instead, I received ERROR 2026 (HY000): SSL connection error: SSL certificate validation failure)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!