vertica / vertica-nodejs

Official native node.js client for the Vertica Analytics Database.
https://www.vertica.com/
Apache License 2.0
12 stars 14 forks source link

TLS verify-full fix host #137

Closed sitingren closed 6 months ago

sitingren commented 6 months ago

When connect to a remote server with tls_mode = 'verify-full', the client throws an error message Hostname/IP does not match certificate's altnames: Host: localhost. is not in the cert's altnames: DNS:abc.example.com.

This is because the nodejs tls module uses 'localhost' as the default host when checking the server's host name against the certificate. This PR takes the user input host (not DNS resolved or load balanced) and pass to the tls_options for verifying the certificate. This doesn't change the host the socket should connect to.

sitingren commented 6 months ago

@DMickens I found this bug and tested this PR within sqltools. You may consider change the tls test/framework in another PR.

DMickens commented 6 months ago

@DMickens I found this bug and tested this PR within sqltools. You may consider change the tls test/framework in another PR.

I'm not quite sure what we would do in the tests/framework differently. We don't really have the ability to not run against localhost. It can be tested manually.

Regardless that was a good catch by you. I think most deployments do not have the server running locally, which means we probably don't have many users using verify-full TLS or this would have been reported sooner.