hapostgres / hapostgres/pg_auto_failover
Prevent unauthorized access from localhost
- Dominant language
- C
- Stars
- 1.4k
- Forks
- 142
- Avg merge
- 5h 8m
- Merged PRs (30d)
- 1
Description
Right now the only way to run pg_auto_ctl is to completely trust the node it runs on, because any connection made from "localhost" is allowed to authenticate using "trust". Even when usig `--skip-pg-hba`. This is because we do not change the default `--auth` argument when we run `initdb`. https://www.postgresql.org/docs/12/app-initdb.html
https://github.com/citusdata/pg_auto_failover/blob/7986d6a9e07b6dc925f7bffacba52b0a1eab27a2/src/bin/pg_autoctl/pgctl.c#L755
I tried changing it to `--auth=reject --auth-local=trust`, but this causes connection errors on the `pg_auto_ctl` side.
It would be nice to use UNIX socket connections from pg_auto_ctl to postgres instead of TCP connections over localhost. This way we can make sure that only the `postgres` user (or whatever user used `pg_auto_ctl create` can connect to `postgres` without auth).
Contributor guide
Assessment
This issue has not been assessed yet.