Skip to content

Commit

Permalink
TLS verify-full fix host (#137)
Browse files Browse the repository at this point in the history
  • Loading branch information
sitingren authored Mar 5, 2024
1 parent bc01199 commit b502147
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/vertica-nodejs/lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class Client extends EventEmitter {
tls_config: this.connectionParameters.tls_config,
tls_mode: this.connectionParameters.tls_mode,
tls_trusted_certs: this.connectionParameters.tls_trusted_certs,
tls_host: this.connectionParameters.host,
keepAlive: c.keepAlive || false,
keepAliveInitialDelayMillis: c.keepAliveInitialDelayMillis || 0,
encoding: this.connectionParameters.client_encoding || 'utf8',
Expand Down
2 changes: 2 additions & 0 deletions packages/vertica-nodejs/lib/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class Connection extends EventEmitter {
//this.tls_client_key = config.tls_client_key
//this.tls_client_cert = config.tls_client_cert
this.tls_trusted_certs = config.tls_trusted_certs
this.tls_host = config.tls_host
}
var self = this
this.on('newListener', function (eventName) {
Expand Down Expand Up @@ -166,6 +167,7 @@ class Connection extends EventEmitter {
else if (self.tls_mode === 'verify-full') { //verify that the name on the CA-signed server certificate matches it's hostname
try {
tls_options.rejectUnauthorized = true
tls_options.host = self.tls_host // Hostname/IP to match certificate's altnames
if (self.tls_trusted_certs) {
tls_options.ca = fs.readFileSync(self.tls_trusted_certs).toString()
}
Expand Down

0 comments on commit b502147

Please sign in to comment.