docker-db-backup
docker-db-backup copied to clipboard
backup of Postgres fails if pg_hba.conf forces encryption
Summary
I am unable to backup a postgresql probably due to encryption problems.
Steps to reproduce
Setup a postgresql server that requires SSL encrypted user sessions. Try to backup with the typical DB01_NAME _USER _HOST _PASSWORD settings.
2024-09-19.10:26:14 [INFO] ** [db-backup04] Starting Manual Backup for db-backup04 2024-09-19.10:26:17 [NOTICE] ** [04-x.x.x.x__postgres] Dumping PostgresSQL database: 'postgres' and compressing with 'zstd' pg_dump: error: connection to server at "x.x.x.x", port 5432 failed: could not open certificate file "/root/.postgresql/postgresql.crt": Permission denied connection to server at "x.x.x.x", port 5432 failed: FATAL: pg_hba.conf rejects connection for host "x.x.x.x", user "maitadmin", database "postgres", no encryption 2024-09-19.10:26:17 [INFO] ** [04-x.x.x.x__postgres] DB Backup of 'pgsql_postgres_x.x.x.x_20240919-102617.sql.zst' completed successfully
If I exec into the docker having the problem and use psql to login to the server with the credentials provided in the compose.yml, the connection works like a charm. So I can only assume that network and pg_hba.conf are correct. db_backup however fails with the above error.
What is the expected correct behavior?
Login and backup working from db_backup
Relevant logs and/or screenshots
See above.