node-mysql2
node-mysql2 copied to clipboard
Error [ERR_TLS_CERT_ALTNAME_INVALID]: Hostname/IP does not match certificate's altnames
Im trying to connect to a Google Cloud Platform MySQL instance with SSL enabled using a public IP. However I get the error:
Error: Error [ERR_TLS_CERT_ALTNAME_INVALID]: Hostname/IP does not match certificate's altnames: IP: xx.xx.xxx.xx is not in the cert's list
If I set reject unauthorised to false it works correctly.
There is no way to add the IP to the altnames because Google generates the certificates automatically. I also can't connect to the instance using a hostname because that isn't supported by Google. I've tried adding checkServerIdentity: () => null to the ssl options but get the same results. Is there any secure work around to this?
unfortunately checkServerIdentity can't be passed from the config yet, but I plan to add that
linking related issue: https://github.com/sidorares/node-mysql2/issues/2172