PgBouncer配置不带纯文本密码的auth_user



我正在配置pgBouncer,并且我能够使它与auth_query一起工作。有可能以某种方式加密auth_user的密码吗?最初我尝试使用SCRAM散列,但后来连接会失败。我已经读到md5是可能的,但我已经在服务器上配置了SCAM。

;
; 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"

我正在尝试运行:

psql -h 192.168.1.59 -p 6432 -U alinka test5432

我能够在我的pgbouncer中使用scramb-sha-256加密密码。当您在config.ini中指定scramb-sha-256时

auth_type = scram-sha-256

users.txt中,您需要使用scram来加密auth_user的密码例如

"myauthuser" "SCRAM-SHA-256$4096:blablabla"
"myauhuser5345" "SCRAM-SHA-256$4096:blablabla$"

相关内容

  • 没有找到相关文章

最新更新