![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I would like to recommend removing the deprecation flag from PGPASSWORD. |
#3
| |||
| |||
|
|
postgresbugs <postgresbugs (AT) grifent (DOT) com> writes: I would like to recommend removing the deprecation flag from PGPASSWORD. Do you understand why it's deprecated? It's because on some operating systems, everyone on the machine can see your environment variable values (if they know how to look). We cannot prevent that. |
#4
| |||
| |||
|
|
Assuming that you can't tweak .pgpass (for example, you're just propagating a password you interactively got from the user), what's the recommended way to provide the password? |
#5
| |||
| |||
|
|
Oliver Jowett <oliver (AT) opencloud (DOT) com> writes: Assuming that you can't tweak .pgpass (for example, you're just propagating a password you interactively got from the user), what's the recommended way to provide the password? In the connection string given to PQconnectdb (or equivalent). |
#6
| |||
| |||
|
|
If you're a shell script calling psql / pg_dump / etc, how do you do this? |
#7
| |||
| |||
|
|
Tom Lane wrote: Oliver Jowett <oliver (AT) opencloud (DOT) com> writes: Assuming that you can't tweak .pgpass (for example, you're just propagating a password you interactively got from the user), what's the recommended way to provide the password? In the connection string given to PQconnectdb (or equivalent). If you're a shell script calling psql / pg_dump / etc, how do you do this? -O |
#8
| |||
| |||
|
|
Oliver Jowett <oliver (AT) opencloud (DOT) com> writes: If you're a shell script calling psql / pg_dump / etc, how do you do this? That doesn't strike me as a compelling case for inventing "--password-fd". Such a shell script is going to have a hard time passing a password securely anyway (you weren't planning to "echo $PW" it somewhere, I trust). |
|
And why should the shell script have its fingers on the password in the first place? It has no "need to know", and more chances to leak the password unintentionally than one likes to think about. |
|
If you really don't want to solve the problem with .pgpass, I'd recommend letting the invoked program collect the password for itself. That's exactly why we do the collection on /dev/tty and not stdin. |
#9
| |||
| |||
|
|
Unless the utilities like psql and pg_dump are changed to accept a password as a command line option, I don't think PGPASSWORD should go away. It is too useful for those that know how to properly use and destroy environmental variables. |
|
Again, the advantage is I can let users with no database login have controlled access to database data and utilities without them actually having a user name and password to the database. Without the ability to use PGPASSWORD, I have to expose the password in a .pgpass file for every user I want to allow access. I think that is far more insecure. |
#10
| |||
| |||
|
|
My main objections to using .pgpass are: - the script/application itself has no business meddling with .pgpass |
|
- the user might not want to store their password in .pgpass |
|
- reprompting for the password every time a tool is invoked is at best a major annoyance, and at worst impossible to do. |
![]() |
| Thread Tools | |
| Display Modes | |
| |