diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2017-01-24 17:06:21 -0500 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2017-01-24 17:06:34 -0500 |
| commit | ba005f193d88a8404e81db3df223cf689d64d75e (patch) | |
| tree | 4a620944c4e9c725e34a18a2fe4c991147f3f018 /doc/src | |
| parent | d1ecd539477fe640455dc890216a7c1561e047b4 (diff) | |
Allow password file name to be specified as a libpq connection parameter.
Formerly an alternate password file could only be selected via the
environment variable PGPASSFILE; now it can also be selected via a
new connection parameter "passfile", corresponding to the conventions
for most other connection parameters. There was some concern about
this creating a security weakness, but it was agreed that that argument
was pretty thin, and there are clear use-cases for handling password
files this way.
Julian Markwort, reviewed by Fabien Coelho, some adjustments by me
Discussion: https://postgr.es/m/a4b4f4f1-7b58-a0e8-5268-5f7db8e8ccaa@uni-muenster.de
Diffstat (limited to 'doc/src')
| -rw-r--r-- | doc/src/sgml/libpq.sgml | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml index 2620eec033d..ea7e7da9d42 100644 --- a/doc/src/sgml/libpq.sgml +++ b/doc/src/sgml/libpq.sgml @@ -943,7 +943,7 @@ postgresql://%2Fvar%2Flib%2Fpostgresql/dbname Note that authentication is likely to fail if <literal>host</> is not the name of the server at network address <literal>hostaddr</>. Also, note that <literal>host</> rather than <literal>hostaddr</> - is used to identify the connection in <filename>~/.pgpass</> (see + is used to identify the connection in a password file (see <xref linkend="libpq-pgpass">). </para> @@ -1002,6 +1002,19 @@ postgresql://%2Fvar%2Flib%2Fpostgresql/dbname </listitem> </varlistentry> + <varlistentry id="libpq-connect-passfile" xreflabel="passfile"> + <term><literal>passfile</literal></term> + <listitem> + <para> + Specifies the name of the file used to store passwords + (see <xref linkend="libpq-pgpass">). + Defaults to <filename>~/.pgpass</filename>, or + <filename>%APPDATA%\postgresql\pgpass.conf</> on Microsoft Windows. + (No error is reported if this file does not exist.) + </para> + </listitem> + </varlistentry> + <varlistentry id="libpq-connect-connect-timeout" xreflabel="connect_timeout"> <term><literal>connect_timeout</literal></term> <listitem> @@ -6893,8 +6906,8 @@ myEventProc(PGEventId evtId, void *evtInfo, void *passThrough) Use of this environment variable is not recommended for security reasons, as some operating systems allow non-root users to see process environment variables via - <application>ps</>; instead consider using the - <filename>~/.pgpass</> file (see <xref linkend="libpq-pgpass">). + <application>ps</>; instead consider using a password file + (see <xref linkend="libpq-pgpass">). </para> </listitem> @@ -6903,9 +6916,8 @@ myEventProc(PGEventId evtId, void *evtInfo, void *passThrough) <indexterm> <primary><envar>PGPASSFILE</envar></primary> </indexterm> - <envar>PGPASSFILE</envar> specifies the name of the password file to - use for lookups. If not set, it defaults to <filename>~/.pgpass</> - (see <xref linkend="libpq-pgpass">). + <envar>PGPASSFILE</envar> behaves the same as the <xref + linkend="libpq-connect-passfile"> connection parameter. </para> </listitem> @@ -7187,13 +7199,16 @@ myEventProc(PGEventId evtId, void *evtInfo, void *passThrough) </indexterm> <para> - The file <filename>.pgpass</filename> in a user's home directory or the - file referenced by <envar>PGPASSFILE</envar> can contain passwords to + The file <filename>.pgpass</filename> in a user's home directory can + contain passwords to be used if the connection requires a password (and no password has been specified otherwise). On Microsoft Windows the file is named <filename>%APPDATA%\postgresql\pgpass.conf</> (where <filename>%APPDATA%</> refers to the Application Data subdirectory in the user's profile). + Alternatively, a password file can be specified + using the connection parameter <xref linkend="libpq-connect-passfile"> + or the environment variable <envar>PGPASSFILE</envar>. </para> <para> @@ -7219,8 +7234,8 @@ myEventProc(PGEventId evtId, void *evtInfo, void *passThrough) </para> <para> - On Unix systems, the permissions on <filename>.pgpass</filename> must - disallow any access to world or group; achieve this by the command + On Unix systems, the permissions on a password file must + disallow any access to world or group; achieve this by a command such as <command>chmod 0600 ~/.pgpass</command>. If the permissions are less strict than this, the file will be ignored. On Microsoft Windows, it is assumed that the file is stored in a directory that is secure, so |
