@@ -198,14 +198,6 @@ hostnogssenc <replaceable>database</replaceable> <replaceable>user</replaceabl
198
198
the <literal>hostgssenc</literal> record is ignored except for logging
199
199
a warning that it cannot match any connections.
200
200
</para>
201
-
202
- <para>
203
- Note that the only supported
204
- <link linkend="auth-methods">authentication methods</link> for use
205
- with <acronym>GSSAPI</acronym> encryption
206
- are <literal>gss</literal>, <literal>reject</literal>,
207
- and <literal>trust</literal>.
208
- </para>
209
201
</listitem>
210
202
</varlistentry>
211
203
@@ -1201,14 +1193,13 @@ omicron bryanh guest1
1201
1193
<productname>GSSAPI</productname> is an industry-standard protocol
1202
1194
for secure authentication defined in
1203
1195
<ulink url="https://tools.ietf.org/html/rfc2743">RFC 2743</ulink>.
1204
-
1205
1196
<productname>PostgreSQL</productname>
1206
- supports <productname>GSSAPI</productname> for use as either an encrypted ,
1207
- authenticated layer , or for authentication only .
1197
+ supports <productname>GSSAPI</productname> for authentication ,
1198
+ communications encryption , or both .
1208
1199
<productname>GSSAPI</productname> provides automatic authentication
1209
1200
(single sign-on) for systems that support it. The authentication itself is
1210
1201
secure. If <productname>GSSAPI</productname> encryption
1211
- (see <literal>hostgssenc</literal>) or <acronym>SSL</acronym> encryption are
1202
+ or <acronym>SSL</acronym> encryption is
1212
1203
used, the data sent along the database connection will be encrypted;
1213
1204
otherwise, it will not.
1214
1205
</para>
@@ -1220,37 +1211,46 @@ omicron bryanh guest1
1220
1211
1221
1212
<para>
1222
1213
When <productname>GSSAPI</productname> uses
1223
- <productname>Kerberos</productname>, it uses a standard principal
1224
- in the format
1214
+ <productname>Kerberos</productname>, it uses a standard service
1215
+ principal (authentication identity) name in the format
1225
1216
<literal><replaceable>servicename</replaceable>/<replaceable>hostname</replaceable>@<replaceable>realm</replaceable></literal>.
1226
- The PostgreSQL server will accept any principal that is included in the keytab used by
1227
- the server, but care needs to be taken to specify the correct principal details when
1228
- making the connection from the client using the <literal>krbsrvname</literal> connection parameter. (See
1229
- also <xref linkend="libpq-paramkeywords"/>.) The installation default can be
1230
- changed from the default <literal>postgres</literal> at build time using
1231
- <literal>./configure --with-krb-srvnam=</literal><replaceable>whatever</replaceable>.
1232
- In most environments,
1233
- this parameter never needs to be changed.
1234
- Some Kerberos implementations might require a different service name,
1235
- such as Microsoft Active Directory which requires the service name
1236
- to be in upper case (<literal>POSTGRES</literal>).
1237
- </para>
1238
- <para>
1239
- <replaceable>hostname</replaceable> is the fully qualified host name of the
1240
- server machine. The service principal's realm is the preferred realm
1241
- of the server machine.
1242
- </para>
1243
-
1244
- <para>
1245
- Client principals can be mapped to different <productname>PostgreSQL</productname>
1246
- database user names with <filename>pg_ident.conf</filename>. For example,
1217
+ The principal name used by a particular installation is not encoded in
1218
+ the <productname>PostgreSQL</productname> server in any way; rather it
1219
+ is specified in the <firstterm>keytab</firstterm> file that the server
1220
+ reads to determine its identity. If multiple principals are listed in
1221
+ the keytab file, the server will accept any one of them.
1222
+ The server's realm name is the preferred realm specified in the Kerberos
1223
+ configuration file(s) accessible to the server.
1224
+ </para>
1225
+
1226
+ <para>
1227
+ When connecting, the client must know the principal name of the server
1228
+ it intends to connect to. The <replaceable>servicename</replaceable>
1229
+ part of the principal is ordinarily <literal>postgres</literal>,
1230
+ but another value can be selected via <application>libpq</application>'s
1231
+ <xref linkend="libpq-connect-krbsrvname"/> connection parameter.
1232
+ The <replaceable>hostname</replaceable> part is the fully qualified
1233
+ host name that <application>libpq</application> is told to connect to.
1234
+ The realm name is the preferred realm specified in the Kerberos
1235
+ configuration file(s) accessible to the client.
1236
+ </para>
1237
+
1238
+ <para>
1239
+ The client will also have a principal name for its own identity
1240
+ (and it must have a valid ticket for this principal). To
1241
+ use <productname>GSSAPI</productname> for authentication, the client
1242
+ principal must be associated with
1243
+ a <productname>PostgreSQL</productname> database user name.
1244
+ The <filename>pg_ident.conf</filename> configuration file can be used
1245
+ to map principals to user names; for example,
1247
1246
<literal>pgusername@realm</literal> could be mapped to just <literal>pgusername</literal>.
1248
1247
Alternatively, you can use the full <literal>username@realm</literal> principal as
1249
1248
the role name in <productname>PostgreSQL</productname> without any mapping.
1250
1249
</para>
1251
1250
1252
1251
<para>
1253
- <productname>PostgreSQL</productname> also supports a parameter to strip the realm from
1252
+ <productname>PostgreSQL</productname> also supports mapping
1253
+ client principals to user names by just stripping the realm from
1254
1254
the principal. This method is supported for backwards compatibility and is
1255
1255
strongly discouraged as it is then impossible to distinguish different users
1256
1256
with the same user name but coming from different realms. To enable this,
@@ -1264,39 +1264,34 @@ omicron bryanh guest1
1264
1264
</para>
1265
1265
1266
1266
<para>
1267
- Make sure that your server keytab file is readable (and preferably
1268
- only readable, not writable) by the <productname>PostgreSQL</productname>
1269
- server account. (See also <xref linkend="postgres-user"/>.) The location
1270
- of the key file is specified by the <xref
1267
+ The location of the server's keytab file is specified by the <xref
1271
1268
linkend="guc-krb-server-keyfile"/> configuration
1272
1269
parameter. The default is
1273
- <filename>/usr/local/pgsql/etc/krb5.keytab</filename> (or whatever
1274
- directory was specified as <varname>sysconfdir</varname> at build time).
1270
+ <filename>FILE:/usr/local/pgsql/etc/krb5.keytab</filename>
1271
+ (where the directory part is whatever was specified
1272
+ as <varname>sysconfdir</varname> at build time).
1275
1273
For security reasons, it is recommended to use a separate keytab
1276
1274
just for the <productname>PostgreSQL</productname> server rather
1277
- than opening up permissions on the system keytab file.
1275
+ than allowing the server to read the system keytab file.
1276
+ Make sure that your server keytab file is readable (and preferably
1277
+ only readable, not writable) by the <productname>PostgreSQL</productname>
1278
+ server account. (See also <xref linkend="postgres-user"/>.)
1278
1279
</para>
1280
+
1279
1281
<para>
1280
- The keytab file is generated by the Kerberos software; see the
1281
- Kerberos documentation for details. The following example is
1282
- for MIT-compatible Kerberos 5 implementations:
1282
+ The keytab file is generated using the Kerberos software; see the
1283
+ Kerberos documentation for details. The following example shows
1284
+ doing this using the <application>kadmin</application> tool of
1285
+ MIT-compatible Kerberos 5 implementations:
1283
1286
<screen>
1284
- <prompt>kadmin% </prompt><userinput>ank -randkey postgres/server.my.domain.org</userinput>
1287
+ <prompt>kadmin% </prompt><userinput>addprinc -randkey postgres/server.my.domain.org</userinput>
1285
1288
<prompt>kadmin% </prompt><userinput>ktadd -k krb5.keytab postgres/server.my.domain.org</userinput>
1286
1289
</screen>
1287
1290
</para>
1288
1291
1289
1292
<para>
1290
- When connecting to the database make sure you have a ticket for a
1291
- principal matching the requested database user name. For example, for
1292
- database user name <literal>fred</literal>, principal
1293
- <literal>fred@EXAMPLE.COM</literal> would be able to connect. To also allow
1294
- principal <literal>fred/users.example.com@EXAMPLE.COM</literal>, use a user name
1295
- map, as described in <xref linkend="auth-username-maps"/>.
1296
- </para>
1297
-
1298
- <para>
1299
- The following configuration options are supported for <productname>GSSAPI</productname>:
1293
+ The following authentication options are supported for
1294
+ the <productname>GSSAPI</productname> authentication method:
1300
1295
<variablelist>
1301
1296
<varlistentry>
1302
1297
<term><literal>include_realm</literal></term>
@@ -1319,7 +1314,7 @@ omicron bryanh guest1
1319
1314
<term><literal>map</literal></term>
1320
1315
<listitem>
1321
1316
<para>
1322
- Allows for mapping between system and database user names. See
1317
+ Allows mapping from client principals to database user names. See
1323
1318
<xref linkend="auth-username-maps"/> for details. For a GSSAPI/Kerberos
1324
1319
principal, such as <literal>username@EXAMPLE.COM</literal> (or, less
1325
1320
commonly, <literal>username/hostbased@EXAMPLE.COM</literal>), the
@@ -1346,6 +1341,15 @@ omicron bryanh guest1
1346
1341
</varlistentry>
1347
1342
</variablelist>
1348
1343
</para>
1344
+
1345
+ <para>
1346
+ In addition to these settings, which can be different for
1347
+ different <filename>pg_hba.conf</filename> entries, there is the
1348
+ server-wide <xref linkend="guc-krb-caseins-users"/> configuration
1349
+ parameter. If that is set to true, client principals are matched to
1350
+ user map entries case-insensitively. <literal>krb_realm</literal>, if
1351
+ set, is also matched case-insensitively.
1352
+ </para>
1349
1353
</sect1>
1350
1354
1351
1355
<sect1 id="sspi-auth">
0 commit comments