Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 6f9192d

Browse files
committed
Rename ident authentication over local connections to peer
This removes an overloading of two authentication options where one is very secure (peer) and one is often insecure (ident). Peer is also the name used in libpq from 9.1 to specify the same type of authentication. Also make initdb select peer for local connections when ident is chosen, and ident for TCP connections when peer is chosen. ident keyword in pg_hba.conf is still accepted and maps to peer authentication.
1 parent 4a00148 commit 6f9192d

File tree

7 files changed

+156
-104
lines changed

7 files changed

+156
-104
lines changed

doc/src/sgml/client-auth.sgml

+62-34
Original file line numberDiff line numberDiff line change
@@ -457,16 +457,29 @@ hostnossl <replaceable>database</replaceable> <replaceable>user</replaceable>
457457
<term><literal>ident</></term>
458458
<listitem>
459459
<para>
460-
Obtain the operating system user name of the client (for
461-
TCP/IP connections by contacting the ident server on the
462-
client, for local connections by getting it from the
463-
operating system) and check if it matches the requested
464-
database user name.
460+
Obtain the operating system user name of the client
461+
by contacting the ident server on the client
462+
and check if it matches the requested database user name.
463+
Ident authentication can only be used on TCP/IP
464+
connections. When specified for local connections, peer
465+
authentication will be used instead.
465466
See <xref linkend="auth-ident"> for details.
466467
</para>
467468
</listitem>
468469
</varlistentry>
469470

471+
<varlistentry>
472+
<term><literal>peer</></term>
473+
<listitem>
474+
<para>
475+
Obtain the operating system user name from the operating system
476+
and check if it matches the requested database user name.
477+
This is only available for local connections.
478+
See <xref linkend="auth-peer"> for details.
479+
</para>
480+
</listitem>
481+
</varlistentry>
482+
470483
<varlistentry>
471484
<term><literal>ldap</></term>
472485
<listitem>
@@ -1200,21 +1213,27 @@ omicron bryanh guest1
12001213
</sect2>
12011214

12021215
<sect2 id="auth-ident">
1203-
<title>Ident-based Authentication</title>
1216+
<title>Ident Authentication</title>
12041217

12051218
<indexterm>
12061219
<primary>ident</primary>
12071220
</indexterm>
12081221

12091222
<para>
12101223
The ident authentication method works by obtaining the client's
1211-
operating system user name and using it as the allowed database user
1212-
name (with an optional user name mapping).
1213-
The determination of the client's
1214-
user name is the security-critical point, and it works differently
1215-
depending on the connection type, as described below.
1224+
operating system user name from an ident server and using it as
1225+
the allowed database user name (with an optional user name mapping).
1226+
This is only supported on TCP/IP connections.
12161227
</para>
12171228

1229+
<note>
1230+
<para>
1231+
When ident is specified for a local (non-TCP/IP) connection,
1232+
peer authentication (see <xref linkend="auth-peer">) will be
1233+
used instead.
1234+
</para>
1235+
</note>
1236+
12181237
<para>
12191238
The following configuration options are supported for <productname>ident</productname>:
12201239
<variablelist>
@@ -1230,9 +1249,6 @@ omicron bryanh guest1
12301249
</variablelist>
12311250
</para>
12321251

1233-
<sect3>
1234-
<title>Ident Authentication Over TCP/IP</title>
1235-
12361252
<para>
12371253
The <quote>Identification Protocol</quote> is described in
12381254
RFC 1413. Virtually every Unix-like
@@ -1275,36 +1291,48 @@ omicron bryanh guest1
12751291
since <productname>PostgreSQL</> does not have any way to decrypt the
12761292
returned string to determine the actual user name.
12771293
</para>
1278-
</sect3>
1294+
</sect2>
12791295

1280-
<sect3>
1281-
<title>Ident Authentication Over Local Sockets</title>
1296+
<sect2 id="auth-peer">
1297+
<title>Peer Authentication</title>
1298+
1299+
<indexterm>
1300+
<primary>peer</primary>
1301+
</indexterm>
12821302

12831303
<para>
1284-
On systems supporting <symbol>SO_PEERCRED</symbol> requests for
1304+
The peer authentication method works by obtaining the client's
1305+
operating system user name from the kernel and using it as the
1306+
allowed database user name (with optional user name mapping). This
1307+
is only supported on local connections.
1308+
</para>
1309+
1310+
<para>
1311+
The following configuration options are supported for <productname>peer</productname>:
1312+
<variablelist>
1313+
<varlistentry>
1314+
<term><literal>map</literal></term>
1315+
<listitem>
1316+
<para>
1317+
Allows for mapping between system and database user names. See
1318+
<xref linkend="auth-username-maps"> for details.
1319+
</para>
1320+
</listitem>
1321+
</varlistentry>
1322+
</variablelist>
1323+
</para>
1324+
1325+
<para>
1326+
Peer authentication is only available on systems supporting
1327+
<symbol>SO_PEERCRED</symbol> requests for
12851328
Unix-domain sockets (currently <systemitem
12861329
class="osname">Linux</>, <systemitem class="osname">FreeBSD</>,
12871330
<systemitem class="osname">NetBSD</>, <systemitem class="osname">OpenBSD</>,
1288-
<systemitem class="osname">BSD/OS</>, and <systemitem class="osname">Solaris</systemitem>), ident authentication can also
1289-
be applied to local connections.
1331+
<systemitem class="osname">BSD/OS</>, and <systemitem class="osname">Solaris</systemitem>).
12901332
<productname>PostgreSQL</> uses <symbol>SO_PEERCRED</symbol> to find out
12911333
the operating system name of the connected client process.
1292-
In this case, no security risk is added by
1293-
using ident authentication; indeed it is a preferable choice for
1294-
local connections on such systems.
12951334
</para>
12961335

1297-
<para>
1298-
On systems without <symbol>SO_PEERCRED</> requests, ident
1299-
authentication is only available for TCP/IP connections. As a
1300-
work-around, it is possible to specify the <systemitem
1301-
class="systemname">localhost</> address <systemitem
1302-
class="systemname">127.0.0.1</> and make connections to this
1303-
address. This method is trustworthy to the extent that you trust
1304-
the local ident server.
1305-
</para>
1306-
</sect3>
1307-
13081336
</sect2>
13091337

13101338
<sect2 id="auth-ldap">

doc/src/sgml/runtime.sgml

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ postgres$ <userinput>initdb -D /usr/local/pgsql/data</userinput>
148148
mode is not used; or modify the generated <filename>pg_hba.conf</filename>
149149
file after running <command>initdb</command>, but
150150
<emphasis>before</> you start the server for the first time. (Other
151-
reasonable approaches include using <literal>ident</literal> authentication
151+
reasonable approaches include using <literal>peer</literal> authentication
152152
or file system permissions to restrict connections. See <xref
153153
linkend="client-authentication"> for more information.)
154154
</para>

0 commit comments

Comments
 (0)