-
Notifications
You must be signed in to change notification settings - Fork 156
Open
Description
We're running a setup where PostgreSQL passwords are auto-rotated every month, and we found that PgDog doesn't support connecting with a changed password without restarting. I'm suspecting some kind of cache to avoid going back to postgres to validate the new password.
To reproduce
The setup is thus:
# compose.yml
services:
postgresql:
image: docker.io/library/postgres:18
command: "-c log_statement=all"
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
restart: always
pgdog:
image: ghcr.io/pgdogdev/pgdog:v0.1.32
volumes:
- ./pgdog.toml:/pgdog/pgdog.toml:ro
ports:
- 6432:6432
restart: always# pgdog.toml
[general]
host = "[::]"
port = 6432
passthrough_auth = "enabled_plain"
prepared_statements = "extended_anonymous"
pub_sub_channel_size = 8192
[admin]
password = "admin"
[[databases]]
host = "postgresql"
name = "postgres"After starting the above stack, run the following steps:
Create a user:
PGPASSWORD=postgres psql -h localhost -p 5432 -U postgres postgres -c "create user my_user with password 'first_password'"Verify it can connect to both PostgreSQL directly and via PgDog:
PGPASSWORD=first_password psql -h localhost -p 5432 -U my_user postgres -c '\q'
PGPASSWORD=first_password psql -h localhost -p 6432 -U my_user postgres -c '\q'Then change the password of the user via PostgreSQL directly (not sure if that matters):
PGPASSWORD=postgres psql -h localhost -p 5432 -U postgres postgres -c "alter user my_user with password 'second_password'"Verify the user can still connect directly to PostgreSQL with the new password:
PGPASSWORD=second_password psql -h localhost -p 5432 -U my_user postgres -c '\q'However, it cannot connect via PgDog anymore:
PGPASSWORD=second_password psql -h localhost -p 6432 -U my_user postgres
psql: error: connection to server at "localhost" (::1), port 6432 failed: FATAL: password for user "my_user" and database "postgres" is wrong, or the database does not existReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels