sidorares / sidorares/node-mysql2

Error [ERR_TLS_CERT_ALTNAME_INVALID]: Hostname/IP does not match certificate's altnames

Open
#2,177 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
4.4k
Forks
680
Avg merge
9h 7m
Merged PRs (30d)
59

Description

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The report names no repository file, test, or entry point. Begin with the connection's SSL configuration and Node.js certificate validation, reproducing the failure with rejectUnauthorized enabled against a Google Cloud MySQL public IP. Done would require a documented secure resolution or a repository change with regression coverage, but the issue does not define either.

Written by the indexing model from the issue text.

Assessment

Tech stack
google-cloud, mysql, node.js
Domain
backend, databases, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.