Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connect to SSL database #43

Open
chrisdl opened this issue Jan 25, 2019 · 18 comments
Open

Connect to SSL database #43

chrisdl opened this issue Jan 25, 2019 · 18 comments
Labels

Comments

@chrisdl
Copy link

chrisdl commented Jan 25, 2019

Hi!

I'm having an issue trying to connect o an SSL enabled postgres database, which does not live locally.

FATAL: no pg_hba.conf entry for host "<IP>", user "<UERNAME>", database "<DBNAME>", SSL off

I've tried adding the ?ssl=true to the connection string, which is what I needed to do for my API to talk to the database, but (1) I don't know where to do that on the "standard" connection tab and (2) if I do it using the "Connect URL" tab it complains about the sslmode having an invalid value of true.

Great product!

@willvincent
Copy link
Contributor

Interesting.. I don't have an ssl enabled server to test against at the moment, but if I try appending the ssl=true param to the end of the connect string, I get the sort of message I expect.

screenshot_20190126_005323

@chrisdl
Copy link
Author

chrisdl commented Jan 28, 2019

I think this may be a heroku specific issue. but I tried it with bdash (https://www.bdash.io/) just to make sure I wasn't eating crazy pills, and I could connect to it just fine.

The reason I tried bdash was because I ran into this: bdash-app/bdash#7
which led me to this: https://devcenter.heroku.com/articles/connecting-to-heroku-postgres-databases-from-outside-of-heroku#ssl

I would like to keep using postbird.

appending ?sslmode=require seems to not even register with postbird. (same pg_hba.conf error message)

@osmuse
Copy link

osmuse commented Jan 29, 2019

I am having the same issue. How do you specify SSL in the standard connection tab?

@Paxa
Copy link
Owner

Paxa commented Jan 30, 2019

What OS do you use?

On MacOS postbird will use https://github.com/brianc/node-pg-native and on Linux with Windows https://github.com/brianc/node-postgres (I can only many static build of libpq for mac)

By experimenting I found that node-pg-native needs ?ssl= be something like disable, allow, prefer (default), require, verify-ca, verify-full
But node-postgres will accept ?ssl=1 or ?ssl=true, otherwise false (default is false)


Heroku URL (via heroku login) will be with ?ssl=verify-full, for now you may open inspector by View -> Toggle Developer Tools, try connect to heroku db, and you see log message like

connecting to postgres://xxx:[email protected]:5432/xxxx?ssl=verify-full

Change ssl=verify-full to ssl=1 and try to connect via URL form


For now there is no way to specify ssl via normal form, only with "Connect URL"

This is defiantly a bug, will try to fix it

@Paxa Paxa added the bug label Jan 30, 2019
@chrisdl
Copy link
Author

chrisdl commented Jan 31, 2019

i'm on macOS. I was trying to use Connect URL with ?ssl=require or ?sslmode=require but neither of those seemed to work. verify-full showed the pg_hba.conf error and the ssl=1 showed "invalid value true"

@db1359
Copy link

db1359 commented Apr 25, 2019

How do I fix this?
Screen Shot 2019-04-25 at 11 39 40 AM

@Paxa
Copy link
Owner

Paxa commented May 6, 2019

Can you please try with new version? I made small improvements for enabling ssl

@db1359
Copy link

db1359 commented May 6, 2019 via email

@chrisdl
Copy link
Author

chrisdl commented May 6, 2019

version 0.8.2
ssl=true          # invalid sslmode
ssl=1               # no pg_hba.conf
ssl=require     # pg_hba
ssl=verify-full # pg_hba

Is there some other configuration I should try?

@Paxa
Copy link
Owner

Paxa commented Jun 16, 2019

Can you try with this package? https://postbird.paxa.kuber.host/2019_06_16.13_11-disable-libpq-4bc4376
I disabled libpq, may be it work

@chrisdl
Copy link
Author

chrisdl commented Jun 18, 2019

@Paxa with the version provided in #43 (comment) the ssl=true at the end of the connection string worked!

@thiagofasano
Copy link

I have the same error =( connection Digital Ocean error: SSL off.

@chrisdl
Copy link
Author

chrisdl commented Jul 17, 2019

@thiagofasano you could rock it cutting edge style and run the package from #43 (comment)

@Paxa I feel like this issue is actually resolved now, or do you want to wait for it to get released?

@thiagofasano
Copy link

@chrisdl not work.. ssl=true

@adsteel
Copy link

adsteel commented Feb 4, 2020

Per this suggestion here, I found that appending ?ssl=verify-full to the connection url works for me.

@stevennyman
Copy link

The latest development artifacts seem to have this problem fixed (https://postbird.paxa.kuber.host/2020_01_19.16_38-master-1020bfa - link from near the bottom of the readme).

@btd1337
Copy link

btd1337 commented Dec 19, 2020

The problem in connect via URL is don't save the connection.


Heroku message

SSL

Applications outside of the Heroku network must support and enable SSL to connect to a Heroku Postgres database. Most clients connect over SSL by default, but sometimes it’s necessary to add the sslmode=require query parameter to your database URL before connecting.

Be sure to append the sslmode=require parameter to your database’s URL from code, rather than by editing the value of your DATABASE_URL config var directly. Various automated events (such as a failover) can change the value of the config var, which overwrites any edits you make.


Is any way to connect in standard mode adding ssl?

@chibuezedev
Copy link

for postbird, appending ?ssl=true to the connection url solved my own problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

10 participants