Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POSTGRES_HOST_AUTH_METHOD not working as documented on 14.4 #981

Closed
cap10morgan opened this issue Jul 27, 2022 · 1 comment
Closed

POSTGRES_HOST_AUTH_METHOD not working as documented on 14.4 #981

cap10morgan opened this issue Jul 27, 2022 · 1 comment
Labels
question Usability question, not directly related to an error with the image

Comments

@cap10morgan
Copy link

cap10morgan commented Jul 27, 2022

The documentation on POSTGRES_HOST_AUTH_METHOD says that specifying a value for the POSTGRES_HOST_AUTH_METHOD env var will add a host all all all $POSTGRES_HOST_AUTH_METHOD line to the pg_hba.conf file in the container. It also says, "If unspecified then scram-sha-256 password authentication is used (in 14+; md5 in older releases)."

Neither of these things happen in a newly-created 14.4 container. If I don't specify it, I don't get the expected host all all all scram-sha-256 line in the /var/lib/postgresql/data/pg_hba.conf file in the container, nor do I if I specify -e POSTGRES_HOST_AUTH_METHOD=scram-sha-256 in my docker run ... command. And I can't connect from another host (with the error that the host doesn't have an entry in pg_hba.conf).

UPDATE: Actually specifying it does work if its a newly-created pg_hba.conf. I had it in a volume so it wasn't modifying an existing file, which seems reasonable.

Am I misunderstanding something here?

@yosifkit
Copy link
Member

UPDATE: Actually specifying it does work if its a newly-created pg_hba.conf. I had it in a volume so it wasn't modifying an existing file, which seems reasonable.

Correct, it only appends to pg_hba.conf when it is a newly initialized database.

# only run initialization on an empty data directory
if [ -z "$DATABASE_ALREADY_EXISTS" ]; then
docker_verify_minimum_env
# check dir permissions to reduce likelihood of half-initialized database
ls /docker-entrypoint-initdb.d/ > /dev/null
docker_init_database_dir
pg_setup_hba_conf "$@"

@wglambert wglambert added the question Usability question, not directly related to an error with the image label Jul 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Usability question, not directly related to an error with the image
Projects
None yet
Development

No branches or pull requests

3 participants