-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Unable to connect through SSL #2178
Comments
Based on this: https://nodejs.org/api/tls.html#tls_tls_connect_options_callback you could try to implement the checkServerIdentity function in the ssl config options: ssl: {
checkServerIdentity: () => {},
// rejectUnauthorized: false,
ca: configService.dbServerCA, // downloaded from GCC
cert: configService.dbClientCert, // downloaded from GCC
key: configService.dbClientKey, // downloaded from GCC
enableTrace: true,
}, I think, the certificate is still validated, only the server name check is skipped. |
Thank you @boromisp for your quick response, I have implemented this function and now it works. I've read about |
Depending on how Google Cloud’s CAs work, it might be important to check the name, though. brianc/node-postgres-docs#79 suggests that there is a name to check, and provides the way to do it. |
I'm using
"pg": "^8.0.3"
with nestjs and TypeOrm to connect to a PostgreSQL database hosted on Google Cloud.I have the following configuration for the db connection.
When I start my application I receive the error following message:
Error [ERR_TLS_CERT_ALTNAME_INVALID]: Hostname/IP does not match certificate's altnames: Host: localhost. is not cert's CN: **********
What I've read/and tested is that I should use
rejectUnauthorized: false
, but doing this I give up on security features. Am I missing something with regards to configuration options, that should allow me to use SSL withoutrejectUnauthorized: false
?The text was updated successfully, but these errors were encountered: