Description
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
and auth_password
) to obtain user password.
auth_query "SELECT usename, passwd FROM pg_shadow WHERE usename=$1"
auth_user ""
auth_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.