Skip to content

Add PGSSLMODE=no-verify support to opt-out of rejecting self-signed certs - #2195

Merged
brianc merged 1 commit into
brianc:masterfrom
bensalilijames:bhsj/noverify
May 7, 2020
Merged

brianc merged 1 commit into
brianc:masterfrom
bensalilijames:bhsj/noverify

Conversation

@bensalilijames

@bensalilijames bensalilijames commented May 5, 2020 •

Copy link
Copy Markdown
Contributor

Upgrading to pg@8 is currently quite hard if relying on environment variables to set the SSL mode. For example, on Heroku, SSL is required, but the certs are not available. A good way to set this up traditionally is to set PGSSLMODE=require for app dynos, and PGSSLMODE=false (or not defined) for in-dyno CI (local ephemeral test databases).

However, in pg@8 the { rejectUnauthorized: false } option needs to be used, so this means consumers need to update all code to be aware of the environment it's running in. This also extends to code from third parties (e.g. migration frameworks like db-migrate), which would need to internally set this option to continue working. All of this means it's quite hard to upgrade.

A simple solution is to to support implementing a PGSSLMODE=no-verify option as suggested in this comment: #2009 (comment). This PR does exactly that! 👍

@bensalilijames bensalilijames changed the title Add PGSSLMODE=noverify support to opt-out of rejecting self-signed certs Add PGSSLMODE=no-verify support to opt-out of rejecting self-signed certs May 5, 2020
@brianc

brianc commented May 5, 2020

Copy link
Copy Markdown
Owner

Thanks for adding this @benjames! I agree we need this. I'm going to need to write some tests for this before I merge it, but I'll do that & get it integrated within the next few days here!

@bensalilijames

Copy link
Copy Markdown
Contributor Author

Thanks @brianc - much appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants