I am working on configuration of pgBouncer and I was able to make it work with auth_query. Is it possible to somehow encrypt password for auth_user? Initially I tried to use SCRAM hash but then connections would fail. I've read that md5 is possible, but I have SCAM configured on the server already.
;
; pgbouncer configuration example
;
[databases]
test5432 = port=5432 host=localhost auth_user=myauthuser
alin = port=5435 host=localhost auth_user=myauthuser5435
[pgbouncer]
listen_addr = *
listen_port = 6432
admin_users = postgres
;stats_users = monitoring userid
auth_type = scram-sha-256
; put these files somewhere sensible:
auth_query = SELECT usename, passwd FROM user_search($1)
auth_file = users.txt
logfile = pgbouncer.log
pidfile = pgbouncer.pid
server_reset_query = DISCARD ALL;
; default values
pool_mode = session
default_pool_size = 20
log_pooler_errors = 1
users.txt
"postgres" "SCRAM-SHA-256$4096:Ou4b7GtxwKdQ2NnKwHUxoQ==$RT+nGDekJIzK4L9wxGY4W7$
"myauthuser" "asdf"
"myauhuser5345" "asdf"
I am trying to run:
psql -h 192.168.1.59 -p 6432 -U alinka test5432