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

fix name, location of pgpass file #58

Closed
jberkus opened this issue Oct 4, 2015 · 5 comments
Closed

fix name, location of pgpass file #58

jberkus opened this issue Oct 4, 2015 · 5 comments
Assignees

Comments

@jberkus
Copy link
Contributor

jberkus commented Oct 4, 2015

just a note because I won't get to it in the next couple days: the pgpass file created by patroni is named incorrectly. it needs a leading period.

Also, this pgpass file is automatically created in the working directory from which patroni is called, which isn't necessarily the user's home directory.

@jberkus jberkus changed the title fix name of pgpass file fix name, location of pgpass file Oct 4, 2015
@alexeyklyukin
Copy link
Contributor

It works because patroni sets the environment variable PGPASSFILE to point to the new pgpass file. It would be a a poor decision to overwrite user's .pgpass with our credentials.

@jberkus
Copy link
Contributor Author

jberkus commented Oct 4, 2015

OK, that works for the name, but the problem is that pgpass gets dropped in the CWD from which patroni was called, regardless of where that is. This causes some issues:

  1. If patroni is called from inside the data directory, that will cause pg_basebackup to fail, because "directory is not empty"
  2. if patroni is called from an insecure directory (like /tmp/) then an attacker can subvert the file permissions and capture the passwords.

... so I think it would be a better idea to drop the file in a specific directory, or at least provide that as a config option. No?

@alexeyklyukin
Copy link
Contributor

Yeah, those seem to be good corner cases we haven't covered yet. Would it be better to just write the file to the home directory of the user that launched patroni? After all, it has the same privacy expectations as .pgpass.

@jberkus
Copy link
Contributor Author

jberkus commented Oct 4, 2015

Yeah, that would work, provided that we can know the homedir. We should have some kind of fallback if it's undefined. Also, a config variable for password_directory, I think

@alexeyklyukin alexeyklyukin self-assigned this Oct 19, 2015
@feikesteenbergen
Copy link
Contributor

pgpass is now configurable under postgresql

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

3 participants