Обсуждение: How to create a postgres user that auth by AUTH_REQ_MD5

Поиск
Список
Период
Сортировка

How to create a postgres user that auth by AUTH_REQ_MD5

От
Hoa Phan
Дата:

How do I create user that required AUTH_REQ_MD5 or config database so that it require AUTH_REQ_MD5 ?

I need to reproduce the following issue where postgres failed to login and I can confirm that the raw username/pass is perfectly fine and JDBC is happy to connect if only it's not AUTH_REQ_MD5. I dont know how on that env it ends up being the case.

org.postgresql.util.PSQLException: FATAL: password authentication failed for user "hoaphan
"
    at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:516)
    at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:141)
    at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:192)
    at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
    at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:195)
    at org.postgresql.Driver.makeConnection(Driver.java:454)
    at org.postgresql.Driver.connect(Driver.java:256)
    at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:136)
    at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:369)
    at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:198)
    at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:467)
    at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:541)
    at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115)
    at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112)
    at org.flywaydb.core.internal.jdbc.JdbcUtils.openConnection(JdbcUtils.java:56)
    at org.flywaydb.core.internal.database.DatabaseFactory.createDatabase(DatabaseFact


Regards,

Hoa Phan.

Re: How to create a postgres user that auth by AUTH_REQ_MD5

От
Tom Lane
Дата:
Hoa Phan <s50600822@gmail.com> writes:
> How do I create user that required AUTH_REQ_MD5 or config database so that
> it require AUTH_REQ_MD5 ?

That's determined by your pg_hba.conf rules.  If you really want to
have just one user acting that way, you can use a rule that keys on
user name; but it's an unusual thing to do I think.

https://www.postgresql.org/docs/current/auth-pg-hba-conf.html

            regards, tom lane