diwata
diwata copied to clipboard
Could not connect to database (no SSL connection possible?)
Trying this out on a hosted database I got the following:
connection Error: DbError(PlatformError(PostgresError(GenericError("From conversion", Error(Db(DbError { severity: "FATAL", parsed_severity: None, code: SqlState("28000"), message: "no pg_hba.conf entry for host \"......\", user \"......\", database \"......\", SSL off", detail: None, hint: None, position: None, where_: None, schema: None, table: None, column: None, datatype: None, constraint: None, file: Some("auth.c"), line: Some(470), routine: Some("ClientAuthentication") }))))))
I suspect (?) the problem may be that SSL is required by the db host, but is turned off by rustorm over here: https://github.com/ivanceras/rustorm/blob/8da5be8dd143591f6ae09d1469fa4a54ba496d40/src/pg/mod.rs#L34
EDIT: note that the hosting is on heroku https://devcenter.heroku.com/articles/connecting-to-heroku-postgres-databases-from-outside-of-heroku#ssl
@rehno-lindeque Thanks for reporting, I'll have to enable ssl in rustorm.
@rehno-lindeque this requires a little bit of configuration, like pointing to a server.crt file. I haven't used the paid version of heroku, i don't exactly know how the set-up is.
Thanks @ivanceras, I wonder if you can set up your own self-signed certificate on your localhost. Maybe https://www.postgresql.org/docs/10/static/ssl-tcp.html#SSL-CERTIFICATE-CREATION can help.
@rehno-lindeque I did a self-signed certificate but it seems heroku rejected it stating that it's self signed.
Ah for heroku you may want to use https://letsencrypt.org/ for a free certificate. (Hopefully they'll accept that)