self signed certificate in certificate chain
See original GitHub issueNode.js version: 14.17.0 pg version: 8.6.0
other related packages:
"pg-connection-string": "^2.5.0",
"pg-pool": "^3.3.0",
"pg-protocol": "^1.5.0",
code:
const options = {
connectionString: 'postgres://username:password@host:port/dbname?sslmode=verify-full',
connectionTimeoutMillis: 50000,
query_timeout: 50000,
ssl: {
ca: <loaded from file>,
rejectUnauthorized: false
}
}
const client = new pg.Client(options)
try {
await client.connect()
} catch(err) {
if (err) {
console.error('failed to connect to pg client', err)
process.exit(1)
}
}
output is as following:
failed to connect to pg client Error: self signed certificate in certificate chain
at TLSSocket.onConnectSecure (_tls_wrap.js:1507:34)
at TLSSocket.emit (events.js:376:20)
at TLSSocket._finishInit (_tls_wrap.js:932:8)
at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:706:12) {
code: 'SELF_SIGNED_CERT_IN_CHAIN'
}
workable with NODE_TLS_REJECT_UNAUTHORIZED=0
, but it is not suggested to program security.
Issue Analytics
- State:
- Created 2 years ago
- Comments:11
Top Results From Across the Web
Openssl : error "self signed certificate in certificate chain"
You have a certificate which is self-signed, so it's non-trusted by default, that's why OpenSSL complains. This warning is actually a good thing, ......
Read more >6 Ways to fix : SSL certificate problem: self signed ... - Jhooq
Scenario 1 : Git clone - SSL certificate problem: self signed certificate in certificate chain ... It is one of the most common...
Read more >Generating a self-signed Certificate Chain Using openssl
To build a self-signed certificate chain, begin by creating a certificate configuration file like this: [ req ] default_bits = 4096 default_keyfile ...
Read more >Solve error "self-signed certificate in certificate chain"
This article explains how to solve the error "self-signed certificate in certificate chain" · The error happens when you're trying to access My ......
Read more >Understanding Self-Signed Certificate in Chain Issues on ...
It means that the certificate attached to the package is a way to be sure that the package was not modified from the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@NicholasIoanJones If all you need to specify is
rejectUnauthorized: false
, you can omitssl
from the configuration object and switch betweensslmode=no-verify
in production and nosslmode
in development.I’m also running into this, using PostgreSQL as a service, and it includes a
?sslmode=require
in its connection params, which means that my code always fails since I can’t pass in the cert.