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

Can not configure custom authorization at pg_hba.conf because of more global rule #1132

Open
EugenKon opened this issue Sep 29, 2023 · 2 comments

Comments

@EugenKon
Copy link

EugenKon commented Sep 29, 2023

docker-entrypoint.sh sets up host all all all scram-sha-256 into pg_hba.conf file.

printf 'host all all all %s\n' "$POSTGRES_HOST_AUTH_METHOD"

For my database located in trusted network I wan to configure trusted authentication, but can not, because first list matched first:

...
host all all all scram-sha-256
host db user 172.16.0.0/12 trust

My /docker-entrypoint-initdb.d/000-trust.sh script is:

echo "host db user 172.16.0.0/12 trust" >> "${PGDATA}/pg_hba.conf"

It would be nice if this catch-all rule you will add later after processing init files

@tianon
Copy link
Member

tianon commented Dec 8, 2023

I'm not sure what changes we can safely make to that ordering, but you should be able to handle this in your initdb script via sed, something like:

sed -i -e '/^host all all all/d' "$PGDATA/pg_hba.conf"

@EugenKon
Copy link
Author

EugenKon commented Dec 8, 2023

It would be nice to disable that functionality so user can manage it manually, eg. CUSTOM_PG_HBA=true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants