Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Cloud SQL: Error [ERR_TLS_CERT_ALTNAME_INVALID]: Hostname/IP does not match certificate's altnames #62

Closed
joshxyzhimself opened this issue Apr 22, 2020 · 3 comments

Comments

@joshxyzhimself
Copy link

Context:

Connection works if rejectUnauthorized is set to false

const sql = postgres({
  // host, port, username, password, etc..
  ssl: { ca, cert, key, rejectUnauthorized: false },
});

Not sure what's the right approach to fix it yet, but putting it out here in case someone encounters it.

Didn't encoutered this one on DigitalOcean's PostgreSQL instances.

@porsager
Copy link
Owner

Cool.. Someone else is definitely going to bump into this yeah.

You can do as you describe here, but it leaves you open to MITM attacks. Instead I think you should follow the Google Cloud SQL guide on setting ssl up properly https://cloud.google.com/sql/docs/mysql/authorize-ssl

Would love to know how it works out for you 😉

@joshxyzhimself
Copy link
Author

Hi there,

Yes I think you're right, I should've read those pages thoroughly.

Thank you very much.

@karlhorky
Copy link
Contributor

Added a PR to document this in the readme here: #126

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants