-
Notifications
You must be signed in to change notification settings - Fork 222
Allow an 'auth_query' so passwords for pools can be loaded from database servers #253
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
Comments
Postgres 14 switched to SCRAM, will this still work? |
MD5 is still available (and widely used), not an expert on the new scram method, will investigate a bit further. |
Uhmm, from pgbouncer docu:
It seems that username definition should be drop from pool config, well also the password which is the point of this. I don't see why not this could also be used for scram. Will dig deeper tomorrow, when I have some time. |
Well, the whole scram thing can't be easily implemented given the way the pool works. For "pass-through" authentication to work in scram, PgCat should talk to clients for opening new server connections and currently this is decoupled, server connections are started by PgCat on demand with the client not intervening at all. I have a working proof of concept for MD5, mainly because knowing server hash (by using auth_query) you can construct the salted hash without even knowing the password, but for scram this is not possible, which is the whole point of the protocol in the end. So, even though we could "easily" set up
|
We could try to do what we do for our config validation: fetch all information at boot and store it in a |
Yep, that would do. Still, are you ok on implementing only cleartext/md5 with |
Yeah sure, it's a great feature to have, and as you said there are many installations still using md5. Maybe we'll be able to figure out SCRAM later too. |
Is your feature request related to a problem? Please describe.
We currently use PgBouncer with md5 password method using
auth_query
so we do not need to change its configuration when password changes etc. Also it allows us not to have to set passwords in three places,application -> DB connection pooler -> Database server
.It would be nice to have a feature like PgBouncer/Odyssey have that allows md5 authentication using passwords stored on server backends by means of a query to the target server. This way we only have to tell PgCat one password, the one used to connect to the server for looking up the password. The rest of passwords are obtained from the DB.
Describe the solution you'd like
I find Pgbouncer neat.
In the case of PGCat It would be something like:
auth_query string
Enable remote user authentication.
Whenever a new client connection is opened and MD5 auth is used, use 'auth_query' against target server (using
auth_user
andauth_password
) to obtain user password.This is usually done using a function so you can use an unprivileged user that have access to just this table (see this)
Disabled by default.
Also, to ease deployment in containerized environments It would be nice to be able to overwrite
auth_query_password
using an environment variable like (PGCAT_AUTH_QUERY_PASSWORD
) , this way, if also admin password can be overridden by an Env var, config file will be password-less which improves security and simplifies deployment in containerized environments.NOTE: I currently have some bandwidth to implement this.
The text was updated successfully, but these errors were encountered: