Skip to content

rejectUnauthorized: false is included in the documentation for connections when TLS self-signed client certs are in use #3600

@PhilipAtCisco

Description

@PhilipAtCisco

The example in https://node-postgres.com/features/ssl#self-signed-cert currently documents setting "rejectUnauthorized: false" option with a custom CA (and also the example below it for connectionString)

const config = {
  database: 'database-name',
  host: 'host-or-ip',
  // this object will be passed to the TLSSocket constructor
  ssl: {
    rejectUnauthorized: false,
    ca: fs.readFileSync('/path/to/server-certificates/root.crt').toString(),
    key: fs.readFileSync('/path/to/client-key/postgresql.key').toString(),
    cert: fs.readFileSync('/path/to/client-certificates/postgresql.crt').toString(),
  },
}

Is this correct when a self signed CA is in use?

It seems like an incorrect TLS client connection option to use as it would disable CA validation and should be set to 'true', unless I'm missing something?
https://nodejs.org/api/tls.html#tlsconnectoptions-callback

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions