@@ -1362,6 +1362,7 @@ omicron bryanh guest1
1362
1362
1363
1363
<para>
1364
1364
LDAP authentication can operate in two modes. In the first mode,
1365
+ which we will call the simple bind mode,
1365
1366
the server will bind to the distinguished name constructed as
1366
1367
<replaceable>prefix</> <replaceable>username</> <replaceable>suffix</>.
1367
1368
Typically, the <replaceable>prefix</> parameter is used to specify
@@ -1371,24 +1372,27 @@ omicron bryanh guest1
1371
1372
</para>
1372
1373
1373
1374
<para>
1374
- In the second mode, the server first binds to the LDAP directory with
1375
+ In the second mode, which we will call the search+bind mode,
1376
+ the server first binds to the LDAP directory with
1375
1377
a fixed user name and password, specified with <replaceable>ldapbinduser</>
1376
1378
and <replaceable>ldapbinddn</>, and performs a search for the user trying
1377
1379
to log in to the database. If no user and password is configured, an
1378
1380
anonymous bind will be attempted to the directory. The search will be
1379
1381
performed over the subtree at <replaceable>ldapbasedn</>, and will try to
1380
1382
do an exact match of the attribute specified in
1381
- <replaceable>ldapsearchattribute</>. If no attribute is specified, the
1382
- <literal>uid</> attribute will be used. Once the user has been found in
1383
+ <replaceable>ldapsearchattribute</>.
1384
+ Once the user has been found in
1383
1385
this search, the server disconnects and re-binds to the directory as
1384
1386
this user, using the password specified by the client, to verify that the
1385
- login is correct. This method allows for significantly more flexibility
1387
+ login is correct. This mode is the same as that used by LDAP authentication
1388
+ schemes in other software, such as Apache mod_authnz_ldap and pam_ldap.
1389
+ This method allows for significantly more flexibility
1386
1390
in where the user objects are located in the directory, but will cause
1387
1391
two separate connections to the LDAP server to be made.
1388
1392
</para>
1389
1393
1390
1394
<para>
1391
- The following configuration options are supported for LDAP :
1395
+ The following configuration options are used in both modes :
1392
1396
<variablelist>
1393
1397
<varlistentry>
1394
1398
<term><literal>ldapserver</literal></term>
@@ -1419,6 +1423,10 @@ omicron bryanh guest1
1419
1423
</para>
1420
1424
</listitem>
1421
1425
</varlistentry>
1426
+ </variablelist>
1427
+
1428
+ The following options are used in simple bind mode only:
1429
+ <variablelist>
1422
1430
<varlistentry>
1423
1431
<term><literal>ldapprefix</literal></term>
1424
1432
<listitem>
@@ -1437,6 +1445,10 @@ omicron bryanh guest1
1437
1445
</para>
1438
1446
</listitem>
1439
1447
</varlistentry>
1448
+ </variablelist>
1449
+
1450
+ The following options are used in search+bind mode only:
1451
+ <variablelist>
1440
1452
<varlistentry>
1441
1453
<term><literal>ldapbasedn</literal></term>
1442
1454
<listitem>
@@ -1469,23 +1481,52 @@ omicron bryanh guest1
1469
1481
<listitem>
1470
1482
<para>
1471
1483
Attribute to match against the user name in the search when doing
1472
- search+bind authentication.
1484
+ search+bind authentication. If no attribute is specified, the
1485
+ <literal>uid</> attribute will be used.
1473
1486
</para>
1474
1487
</listitem>
1475
1488
</varlistentry>
1476
1489
</variablelist>
1477
1490
</para>
1478
1491
1479
- <note>
1492
+ <para>
1493
+ It is an error to mix configuration options for simple bind with options
1494
+ for search+bind.
1495
+ </para>
1496
+
1497
+ <para>
1498
+ Here is an example for a simple-bind LDAP configuration:
1499
+ <programlisting>
1500
+ host ... ldap ldapserver=ldap.example.net ldapprefix="cn=" ldapsuffix=", dc=example, dc=net"
1501
+ </programlisting>
1502
+ When a connection to the database server as database
1503
+ user <literal>someuser</literal> is requested, PostgreSQL will attempt to
1504
+ bind to the LDAP server using the DN <literal>cn=someuser, dc=example,
1505
+ dc=net</literal> and the password provided by the client. If that connection
1506
+ succeeds, the database access is granted.
1507
+ </para>
1508
+
1509
+ <para>
1510
+ Here is an exaple for a search+bind configuration:
1511
+ <programlisting>
1512
+ host ... ldap ldapserver=ldap.example.net ldapbasedn="dc=example, dc=net" ldapsearchattribute=uid
1513
+ </programlisting>
1514
+ When a connection to the database server as database
1515
+ user <literal>someuser</literal> is requested, PostgreSQL will attempt to
1516
+ bind anonymously (since <literal>ldapbinddn</literal> was not specified) to
1517
+ the LDAP server, perform a search for <literal>(uid=someuser)</literal>
1518
+ under the specified base DN. If an entry is found, it will then attempt to
1519
+ bind using that found information and the password supplied by the client.
1520
+ If that second connection succeeds, the database access is granted.
1521
+ </para>
1522
+
1523
+ <tip>
1480
1524
<para>
1481
1525
Since LDAP often uses commas and spaces to separate the different
1482
1526
parts of a DN, it is often necessary to use double-quoted parameter
1483
- values when configuring LDAP options, for example:
1484
- <programlisting>
1485
- ldapserver=ldap.example.net ldapprefix="cn=" ldapsuffix=", dc=example, dc=net"
1486
- </programlisting>
1527
+ values when configuring LDAP options, as shown in the examples.
1487
1528
</para>
1488
- </note >
1529
+ </tip >
1489
1530
1490
1531
</sect2>
1491
1532
0 commit comments