finagle / finagle/finagle-postgres

Unable to set sslmode=require parameter on a Postgres connection

Open
#214 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Scala
Stars
81
Forks
36
PR merge metrics
No merged PRs in 30d

Description

Hi

I am trying to connect to a Postgres hosted by Heroku.

https://devcenter.heroku.com/articles/heroku-postgresql#heroku-postgres-ssl

import com.twitter.finagle.Postgres
val client = Postgres.Client()
.withCredentials("xx", Some("xx"))
.database("xx")
.withSessionPool.maxSize(1)
.newRichClient("xx.eu-west-1.compute.amazonaws.com:5432")

returns an error saying ssl is off as expected
com.twitter.finagle.postgres.codec.ServerError: no pg_hba.conf entry for host "82.2.102.2", user "xx", database "xx", SSL off

I am unable to set sslmode=require on the underlying connection. I have tried
val client = Postgres.Client()
.withCredentials("xx", Some("xx"))
.database("xx")
.withSessionPool.maxSize(1)
.conditionally(true, _.withTransport.tlsWithoutValidation)
.withTransport.tls("amazonaws.com")
.newRichClient("xx.eu-west-1.compute.amazonaws.com:5432")

val client = Postgres.Client()
.withCredentials("xx", Some("xx"))
.database("xx")
.withSessionPool.maxSize(1)
.withTransport.tls("amazonaws.com")
.newRichClient("xx.eu-west-1.compute.amazonaws.com:5432")

val client = Postgres.Client()
.withCredentials("xx", Some("xx"))
.database("xx")
.withSessionPool.maxSize(1)
.conditionally(true, _.withTransport.tlsWithoutValidation)
.newRichClient("xx.eu-west-1.compute.amazonaws.com:5432")

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the Postgres.Client configuration and the newRichClient connection path, then reproduce the reported Heroku PostgreSQL connection with the supplied examples. The issue is resolved when the client can establish the requested SSL connection instead of receiving an “SSL off” pg_hba.conf error.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, scala
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.