odyssey icon indicating copy to clipboard operation
odyssey copied to clipboard

How to configure odyssey with md5 auth to DB?

Open depesz opened this issue 3 years ago • 2 comments

I tried to configure odyssey using this:

storage "postgres_server" {
        type "remote"
        host "localhost"
        port 5432
}
database default {
        user default {
        authentication "md5"
        password "md5d69880bc7328401a6d516723fd22581c"
        auth_query "SELECT usename, passwd FROM pg_shadow WHERE usename=$1"
        auth_query_db "postgres"
        auth_query_user "odyssey"
        storage "postgres_server"
        pool "transaction"
        }
}

When I tried to login to test database as my own user (with verified password from pgpass file, I got:

psql: error: FATAL: odyssey: c074b772d271e: failed to connect to remote server s54c29467ed83

and in odyssey logs:

5463 2021-04-27T12:49:33Z debug [c84f2834260bc none] (auth) PasswordMessage
5463 2021-04-27T12:49:33Z debug [none sf552de489b99] (auth_query) attached to server sf552de489b99
5463 2021-04-27T12:49:33Z debug [none sf552de489b99] (startup) received packet type: Authentication
5463 2021-04-27T12:49:33Z debug [none sf552de489b99] (auth) requested md5 authentication
5463 2021-04-27T12:49:33Z debug [none sf552de489b99] (auth) Authentication
5463 2021-04-27T12:49:33Z debug [none sf552de489b99] (startup) received packet type: ParameterStatus
5463 2021-04-27T12:49:33Z debug [none sf552de489b99] (startup) received packet type: ParameterStatus
5463 2021-04-27T12:49:33Z debug [none sf552de489b99] (startup) received packet type: ParameterStatus
5463 2021-04-27T12:49:33Z debug [none sf552de489b99] (startup) received packet type: ParameterStatus
5463 2021-04-27T12:49:33Z debug [none sf552de489b99] (startup) received packet type: ParameterStatus
5463 2021-04-27T12:49:33Z debug [none sf552de489b99] (startup) received packet type: ParameterStatus
5463 2021-04-27T12:49:33Z debug [none sf552de489b99] (startup) received packet type: ParameterStatus
5463 2021-04-27T12:49:33Z debug [none sf552de489b99] (startup) received packet type: ParameterStatus
5463 2021-04-27T12:49:33Z debug [none sf552de489b99] (startup) received packet type: ParameterStatus
5463 2021-04-27T12:49:33Z debug [none sf552de489b99] (startup) received packet type: ParameterStatus
5463 2021-04-27T12:49:33Z debug [none sf552de489b99] (startup) received packet type: ParameterStatus
5463 2021-04-27T12:49:33Z debug [none sf552de489b99] (startup) received packet type: BackendKeyData
5463 2021-04-27T12:49:33Z debug [none sf552de489b99] (startup) received packet type: ReadyForQuery
5463 2021-04-27T12:49:33Z debug [a71d8165e31bc sf552de489b99] (auth_query) SELECT usename, passwd FROM pg_shadow WHERE usename=$1
5463 2021-04-27T12:49:33Z debug [a71d8165e31bc sf552de489b99] (auth_query) ParseComplete
5463 2021-04-27T12:49:33Z debug [a71d8165e31bc sf552de489b99] (auth_query) BindComplete
5463 2021-04-27T12:49:33Z debug [a71d8165e31bc sf552de489b99] (auth_query) RowDescription
5463 2021-04-27T12:49:33Z debug [a71d8165e31bc sf552de489b99] (auth_query) DataRow
5463 2021-04-27T12:49:33Z debug [a71d8165e31bc sf552de489b99] (auth_query) CommandComplete
5463 2021-04-27T12:49:33Z debug [a71d8165e31bc sf552de489b99] (auth_query) ReadyForQuery
5463 2021-04-27T12:49:33Z debug [c84f2834260bc s2b8b99017831] (setup) client 84f2834260bc attached to s2b8b9901
5463 2021-04-27T12:49:33Z debug [none s2b8b99017831] (startup) received packet type: Authentication
5463 2021-04-27T12:49:33Z debug [none s2b8b99017831] (auth) requested md5 authentication
5463 2021-04-27T12:49:33Z debug [none s2b8b99017831] (auth) ErrorResponse
5463 2021-04-27T12:49:33Z error [c84f2834260bc s2b8b99017831] (auth) FATAL 28P01 password authentication failed for user "depesz-rw"

Unfortunately I see no docs on how to setup md5 authentication in odyssey, so I can't figure it out. Any help?

Also, are there any docs for commands available in console?

depesz avatar Apr 27 '21 12:04 depesz

Based on info in Issue #265 I was able to make config with hardcoded user and its password. Works. But - I thought that it should be possible to not hardcode passwords, thanks to auth_query* options. What am I missing?

depesz avatar Apr 27 '21 16:04 depesz

Seems like a bug. Can you please check that you run version older than https://github.com/yandex/odyssey/commit/8dace7befe4e440fe66348c206838c96a9cd5950 ?

x4m avatar Apr 28 '21 08:04 x4m