我正在尝试配置 Postgres 以接收带有 md5 加密密码的连接。我阅读了大量手册并按照说明进行操作,但我还是失败了。
我们有几个 docker 容器,其中一个是我们使用 init_db.sh 脚本配置的 Postgres 9 容器。运行容器的最终配置是:
listen_addresses = '*'
local all all md5
host all all all md5
运行:lsof -i tcp:5432(我现在在我的 Mac 上运行),产生了这个:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
com.docke 17454 sigals 36u IPv4 0x13ec351b99f025cd 0t0 TCP *:postgresql (LISTEN)
com.docke 17454 sigals 37u IPv6 0x13ec351b8ce8a025 0t0 TCP localhost:postgresql (LISTEN)
当我启动使用加密密码运行的容器时,我得到: 错误 org.apache.tomcat.jdbc.pool.ConnectionPool:182 - 无法创建池的初始连接。
2017-02-08T14:07:43.438478547Z org.postgresql.util.PSQLException: FATAL: password authentication failed for user "myuser"
当我将密码作为明文输入时,它会起作用。
当我将 IP 配置为仅本地主机时,加密和明文密码均有效。
我哪里配置错了?
最佳答案
md5 Require the client to supply a double-MD5-hashed password for authentication. See Section 20.3.2 for details.
password Require the client to supply an unencrypted password for authentication. Since the password is sent in clear text over the network, this should not be used on untrusted networks. See Section 20.3.2 for details.
jdbc 连接会散列您在连接字符串中提供的密码 - 您不必自己对其进行 md5。
关于postgresql - 在docker环境下为tcp md5配置Postgres,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42115387/