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