【问题标题】:pgpool-II authentication failurepgpool-II 认证失败
【发布时间】:2012-10-22 04:35:11
【问题描述】:

我正在使用配置为主热备用的两个 PostgreSQL 9.1 中的 pgpool-II 3.2.1。

当尝试从 PGAdmin 进行身份验证时,我得到:

Error connecting to the server: FATAL:  password authentication failed for user "postgres"

在 pgpool 日志中我看到:

2012-11-01 14:40:13 LOG:   pid 3023: connection received: host=89.xxx.xxx.xxx port=57150
2012-11-01 14:40:13 DEBUG: pid 3023: Protocol Major: 1234 Minor: 5679 database:  user: 
2012-11-01 14:40:13 DEBUG: pid 3023: SSLRequest from client
2012-11-01 14:40:13 DEBUG: pid 3023: pool_ssl: SSL requested but SSL support is not available
2012-11-01 14:40:13 DEBUG: pid 3023: read_startup_packet: application_name: pgAdmin III - Browser
2012-11-01 14:40:13 DEBUG: pid 3023: Protocol Major: 3 Minor: 0 database: postgres user: postgres
2012-11-01 14:40:13 DEBUG: pid 3023: new_connection: connecting 0 backend
2012-11-01 14:40:13 DEBUG: pid 3023: new_connection: connecting 1 backend
2012-11-01 14:40:13 DEBUG: pid 3023: pool_ssl: SSL requested but SSL support is not available
2012-11-01 14:40:13 DEBUG: pid 3023: pool_ssl: SSL requested but SSL support is not available
2012-11-01 14:40:13 DEBUG: pid 3023: pool_read_message_length: slot: 0 length: 12
2012-11-01 14:40:13 DEBUG: pid 3023: pool_read_message_length: slot: 1 length: 12
2012-11-01 14:40:13 DEBUG: pid 3023: pool_do_auth: auth kind:5
2012-11-01 14:40:13 DEBUG: pid 3023: trying md5 authentication
2012-11-01 14:40:13 DEBUG: pid 3023: password does not match: frontend:md5286c9c7c4ac8a365170e0f448c99ad48 pgpool:md5cf0e9615c13af6243edfd11d2461d12e
2012-11-01 14:40:13 DEBUG: pid 3023: do_md5failed in slot 0

真正奇怪的是,日志中的 md5 哈希值会随着每个请求而变化,因此与我在 /usr/local/etc/pool_passwd 和 /usr/local/etc/ 中设置的哈希值相比没有任何意义pcp.conf

你能帮我找出配置问题吗?

【问题讨论】:

    标签: postgresql postgresql-9.1 pgpool


    【解决方案1】:

    找到问题了!

    pg_md5 与 pgpool 一起提供了一个不正确的 md5(当我使用它时)。在我用 PostgreSQL 数据库中的 md5 在配置中替换它之后,它就可以工作了。您可以通过运行以下 SQL 查询来获取 DB md5:

    select passwd from pg_shadow where usename = 'username';
    

    【讨论】:

    • 请注意,我必须在我的 usernamepassword 周围使用 single quotes,否则 pg_md5 生成了错误的哈希值。添加引号后它起作用了。在大多数情况下,这可能是错误的。
    【解决方案2】:

    这取决于你如何使用“pg_md5”...如果你不包括用户名,那么它会生成错误的 MD5,因为毫无疑问,它在 salt 中使用:

    root:/usr/local/etc# pg_md5 password1
    7c6a180b36896a0a8c02787eeafb0e4c
    

    但是,如果您使用正确的语法,那么您会自动将正确的条目放入您的 pool_password 文件中:

    root:/usr/local/etc# pg_md5 -m -u greg password1
    root@1:/usr/local/etc# grep greg: pool_passwd
    greg:md53c5b45b54c89f8af9074a2ad371e2c12
    

    【讨论】:

    • 这样在散列前加上“md5”是否有效?
    • @shadfc: 是的,绝对 - 这是 PostgreSQL 中的标准加密密码格式
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-27
    • 2021-02-13
    相关资源
    最近更新 更多