SSL 与谷歌云 SQL

问题描述 投票:0回答:1

我正在运行一个 Google Cloud mySQL 实例,并指定了“仅允许 SSL 连接”。

当我使用以下方式连接时:

return mysql.createPool({
  host: db_host,
  port: 3306,
  user: db_user,
  password: db_password,
  ssl: {
    rejectUnauthorized: false,
    key: clientKey,
    cert: clientCert,
    ca: serverCa,
  },
});

...它工作正常,但是使用“rejectUnauthorized: false”显然不安全。 如果我删除“rejectUnauthorized: false”,我得到

'Hostname/IP does not match certificate's altnames: IP: ##.##.##.## is not in the cert's list:'

我已经尝试过了

nslookup ##.##.##.##

,这给了我一个名字。

当我尝试将其添加为主机名时,我得到:

Hostname/IP does not match certificate's altnames: Host: ##.##.##.##.bc.googleusercontent.com. is not in the cert's altnames: DNS:'##-########-####-####-####-########.australia-southeast2.sql.goog'

当我尝试添加 '##-########-####-####-####-########.australia-southeast2.sql.goog' 作为主机名,我得到:

'getaddrinfo ENOTFOUND ##-########-####-####-####-########.australia-southeast2.sql.goog'

我尝试过重新生成证书,但这没有什么区别。

我无法想象我是唯一需要从外部源连接到谷歌云 mySQL 实例的人,但是我在网上找不到任何解决方案。

我错过了一些明显的东西吗?

ssl-certificate google-cloud-sql
1个回答
0
投票

好的。这是我发现的。这并不是真正的解决方案,但它可能会阻止其他人绞尽脑汁“寻找”解决方案。这是 2015 年的内容,但似乎仍然有意义。

Cloud SQL 上的证书验证

© www.soinside.com 2019 - 2024. All rights reserved.