wvanbergen / node-vertica

Pure javascript Vertica database client. Except it is written in CoffeeScript.
MIT License
44 stars 30 forks source link

Attempting to connect in ssl 'optional' mode causes exception #63

Open datim opened 6 years ago

datim commented 6 years ago

I'm attempting to to connect to an unsecure Vertica using the ssl mode 'optional'. I'm expecting the connection to eventually succeed by attemping a non-tls connection after the initial SSL handshake fails, but instead I get the following following exception and my program exits:

events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: 101057795:error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure:openssl\ssl\s23_clnt.c:769:

    at Error (native)
    at SlabBuffer.use (_tls_legacy.js:39:18)
    at CleartextStream._read (_tls_legacy.js:257:29)
    at CleartextStream.Readable.read (_stream_readable.js:348:10)
    at EncryptedStream._write (_tls_legacy.js:171:25)
    at doWrite (_stream_writable.js:331:12)
    at writeOrBuffer (_stream_writable.js:317:5)
    at EncryptedStream.Writable.write (_stream_writable.js:243:11)
    at Socket.ondata (_stream_readable.js:555:20)
    at emitOne (events.js:96:13)

My connection code looks something like this:

const { connect } = require('vertica');

var config = {
    database: dbname,
    host: '192.168.1.1',
    ssl: 'optional',
    user: 'dbadmin',
    password: 'dbadmin',
    interruptible: true
};

try {
  connect(config, (err, conn) => {
    if (err) {
      console.log('error');
    } else {
      console.log('success)'
    }
  });
}
catch (error) {
  console.log("Error has been caught");
}

I see the same behavior with the 'verified' mode. My enviornment: