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(),
},
}
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)
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