ldap-guide.html 18.6 KB
Newer Older
Gaston Dombiak's avatar
Gaston Dombiak committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Jive Software - Wildfire: LDAP Guide</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>

<div id="pageContainer">

<a name="top"></a>

	<div id="pageHeader">
		<div id="logo"></div>
		<h1>LDAP Guide</h1>
	</div>
	<div class="navigation">
		<a href="index.html">&laquo; Back to documentation index</a>
	</div>

	<div id="pageBody">

<h2>Introduction</h2>

<p>
    This document details how to configure your Wildfire installation to use
    an external directory such as Open LDAP or Active Directory. Integration with a directory
    lets users authenticate using their directory username and password.
    Optionally, you can configure Wildfire to load user profile and group information from the directory.
    Any group in Wildfire can be designated as a shared group, which means that you can pre-populate user's
    rosters using directory groups.
</p>

<h2>Background</h2>

<p>
    LDAP (Lightweight Directory Access Protocol) has emerged as a dominant standard
    for user authentication and for storage of user profile data. It serves as a
    powerful tool for large organizations (or those organizations integrating many
    applications) to simplify user management issues. Many LDAP servers are available,
    such as <a href="http://www.openldap.org/">Open LDAP</a>, 
    <a href="http://www.microsoft.com/windowsserver2003/technologies/directory/activedirectory/">Active Directory</a>, 
    and Novell's <a href="http://www.novell.com/products/edirectory/">eDirectory</a>.

</p>

<p>
    By default, Wildfire stores all user data in its database and performs
    authentication using database lookups. The LDAP module replaces that
    functionality and allows Wildfire to:
    <ul>
        <li>Use a LDAP server to authenticate a user's identity.</li>
        <li>Load user profile information from a LDAP directory.</li>
        <li>Load group information from an LDAP directory.</li>
    </ul>

    <b>Note:</b> Wildfire treats the LDAP directory as read-only. 
</p>

<p>
    This document will guide you through configuring LDAP support in Wildfire. These
    instructions assume that you're a competent LDAP user, and that you're familiar
    with Wildfire setup issues.
</p>

<h2>Configuration</h2>

<p>
    In order to configure your server to use LDAP:
    <ol>

        <li>
            Stop Wildfire.
        </li>
        <li>Edit <tt>conf/wildfire.xml</tt> in your Wildfire installation folder as
            described below.
        </li>
        <li>
            Restart Wildfire.
        </li>
    </ol>

</p>

<h3>Editing the Config File</h3>

<p>
    Open the configuration file <tt>conf/wildfire.xml</tt> from your Wildfire
    installation in your favorite
    editor and add or change the following settings. Properties flagged with (<font color="red">
    <b>*</b></font>)
    must be set. Properties flagged with (<font color="red"><b>**</b></font>) must be set in order
    to enable LDAP group
    support, all other properties are optional:

</p>
<ul>
    <b>Main Settings</b><br><br>

    <li>provider.user.className <font color="red"><b>*</b></font> -- set the value to
        "org.jivesoftware.wildfire.ldap.LdapUserProvider".</li>
    <li>provider.auth.className <font color="red"><b>*</b></font> -- set the value to
        "org.jivesoftware.wildfire.ldap.LdapAuthProvider".</li>

    <li>ldap.host <font color="red"><b>*</b></font> -- LDAP server host; e.g. localhost or
        machine.example.com, etc. It is possible to use many LDAP servers but all of them
        <b>should share the same configuration</b> (e.g. SSL, baseDN, admin account, etc).
        To specify many LDAP servers use the comma or the white space character as delimiter.</li>
    <li>ldap.port -- LDAP server port number. If this property is not set, the default value is
        389.</li>
    <li>ldap.baseDN <font color="red"><b>*</b></font> -- the starting DN that searches for users
        will performed with.
        The entire subtree under the base DN will be searched for user accounts.
    </li>

    <li>ldap.alternateBaseDN -- a second DN in the directory can optionally be set. If set, the
        alternate base DN
        will be used for authentication and loading single users, but will not be used to display a
        list of users
        (due to technical limitations).
    <li>ldap.adminDN -- a directory administrator's DN. All directory operations will be
            performed
            with this account. The admin must be able to perform searches and load user records. The
            user does
            not need to be able to make changes to the directory, as Wildfire treats the
            directory as read-only.
            If this property is not set, an anonymous login to the server will be attempted.
        </li>
    <li>ldap.adminPassword -- the password for the directory administrator.</li>
    <li>ldap.usernameField -- the field name that the username lookups will be performed on. If
            this property is not set, the default value is <tt>uid</tt>. Active Directory users
            should try the default value <tt>sAMAccountName</tt>.</li>
    <li>ldap.nameField -- the field name that holds the user's name. If this property is not
            set, the default value is <tt>cn</tt>. Active Directory users should use the default value
            <tt>displayName</tt>.</li>

    <li>ldap.emailField -- the field name that holds the user's email address. If this property
            is not set, the default value is <tt>mail</tt>. Active Directory users should use the
            the default value <tt>mail</tt>.</li>
     <li>ldap.searchFields -- the LDAP fields that will be used for user searches. If
        this property is not set, the username, name, and email fields will be searched. An example
        value for this field is "Username/uid,Name/cname". That searches the uid and cname fields
        in the directory and labels them as "Username" and "Name" in the search UI. You can add
        as many fields as you'd like using comma-delimited "DisplayName/Field" pairs. You should
        ensure that any fields used for searching are properly indexed so that searches return
        quickly.</li>
    <li>ldap.searchFilter -- the search filter that should be used when loading users. If this
        property is not set, the default search will be for users that have the attribute specified by
        ldap.usernameField.

    <br><br>
    <b>Group Settings</b><br><br>

    <li>provider.group.className <font color="red"><b>**</b></font> -- set the value to
        "org.jivesoftware.wildfire.ldap.LdapGroupProvider".</li>
    <li>ldap.groupNameField <font color="red"><b>**</b></font> -- the field name that the groupname
        lookups will be performed on. If this property is not set, the default value is <tt>cn</tt>.</li>
    <li>ldap.groupMemberField -- the field name that holds the members in a group. If this property
        is not set, the default value is <tt>member</tt>.</li>

    <li>ldap.groupDescriptionField -- the field name that holds the description a group. If this
        property is not set, the default value is <tt>description</tt>.</li>
    <li>ldap.posixMode <font color="red"><b>**</b></font> -- a value of "true" means that users are stored within the group by their
        user name alone. A value of "false" means that users are stored by their entire DN within
        the group. If this property is not set, the default value is <tt>false</tt>. <b>Note:</b>
        the posix mode must be set correctly for your server in order for group integration to
        work.</li>

    <li>ldap.groupSearchFilter -- the search filter that should be used when loading groups. If this
        property is not set, the default value is <tt>("ldap.groupNameField"={0})</tt>.</li>

    <br><br>
    <b>Connection Settings</b><br><br>

    <li>ldap.debugEnabled -- a value of "true" if debugging should be turned on. When on, trace
            information about buffers sent and received by the LDAP provider is written to
            System.out</li>
    <li>ldap.sslEnabled -- a value of "true" to enable SSL connections to your LDAP server. If
            you
            enable SSL connections, the LDAP server port number most likely should be changed to
            636.</li>

    <li>ldap.initialContextFactory -- the name of the class that should be used as an initial
        context
        factory. if this value is not specified, "com.sun.jndi.ldap.LdapCtxFactory" will be used
        instead.
        Most users will not need to set this value.
    <li>ldap.autoFollowReferrals -- a value of "true" indicates that LDAP referrals should be
        automatically followed. If this property is not set or is set to "false", the referral policy used is left
        up to to the provider. A referral is an entity that is used to redirect a client's request to
        another server. A referral contains the names and locations of other objects. It is sent by the server to
        indicate that the information that the client has requested can be found at another location (or
        locations), possibly at another server or several servers.
    <li>ldap.connectionPoolEnabled -- a value of "false" disables LDAP connection pooling. If this
        property is not set, the default value is "true".

</ul>

<p>
    Below is a sample config file section:
</p>
<pre>
    &lt;jive&gt;
      ...
      &lt;ldap&gt;

        &lt;host&gt;&lt;/host&gt;
        &lt;port>389&lt;/port&gt;
        &lt;usernameField&gt;uid&lt;/usernameField&gt;
        &lt;nameField&gt;cn&lt;/nameField&gt;

        &lt;emailField&gt;mail&lt;/emailField&gt;
        &lt;baseDN&gt;ou=People;dc=example;dc=com&lt;/baseDN&gt;
        &lt;adminDN&gt;cn=Directory Administrator&lt;/adminDN&gt;
        &lt;adminPassword&gt;&lt;/adminPassword&gt;

      &lt;/ldap&gt;
      &lt;provider&gt;
        &lt;user&gt;
          &lt;className&gt;org.jivesoftware.wildfire.ldap.LdapUserProvider&lt;/className&gt;
        &lt;/user&gt;

        &lt;auth&gt;
          &lt;className&gt;org.jivesoftware.wildfire.ldap.LdapAuthProvider&lt;/className&gt;
        &lt;/auth&gt;
        &lt;group&gt;
          &lt;className&gt;org.jivesoftware.wildfire.ldap.LdapGroupProvider&lt;/className&gt;

        &lt;/group&gt;
      &lt;/provider&gt;
      ...
    &lt;/jive&gt;
</pre>

<p>You'll most likely want to change which usernames are authorized to login to the
    admin console. By default, only the user with username "admin" is allowed to login. However,
    you may have different users in your LDAP directory that you'd like to be administrators. The
    list of authorized usernames is controlled via the <tt>admin.authorizedUsernames</tt>
    property. For example, to let the usersnames "joe" and "jane" login to the admin console:</p>

<pre>
    &lt;jive&gt;
      ...
      &lt;admin&gt;
        ...
        &lt;authorizedUsernames&gt;joe, jane&lt;/authorizedUsernames&gt;
      &lt;/admin&gt;

      ...
    &lt;/jive&gt;
</pre>

<p><a name=""><h2>Custom Search Filter</h2></a></p>

<p>By default, Wildfire will load all objects under the baseDN that
    have the attribute specified by <tt>ldap.usernameField</tt>. In the
    case that the username field is set to "uid", the search for all users
    would be "(uid=*)". However, there are cases when this logic does
    not work -- for example, when a directory contains other objects besides
    users but all objects share "uid" as a unique identifier field. In that
    case, you may need to specify a custom search filter using
    <tt>ldap.searchFilter</tt>. As an example, a search filter for all users
    with a "uid" and a "cn" value of "joe" would
    be:</p>

<pre>(&(uid={0})(cn=joe))</pre>

<p>The "{0}" value in the filter above is a token that should be present in
    all custom search filters. It will be dynamically replaced with "*" when
    loading the list of all users or a username when loading a single user.</p>

<p>Some custom search filters may include reserved XML entities such as
    "&". In that case, you must enter the search filter into the wildfire.xml
    file using CDATA:

    <pre>&lt;searchFilter&gt;&lt;![CDATA[(&(sAMAccountName={0})(|(givenName=GEORGE)(givenName=admin)))]]&gt;&lt;/searchFilter&gt;</pre>

    <p><a name="ctxFactory"><h2>Custom Inital Context Factory</h2></a></p>

    <p>

        Some LDAP servers or application servers may require that a different LDAP
        initial context factory be used rather than the default (com.sun.jndi.ldap.LdapCtxFactory).
        You can set a custom initial context factory by adding the following to wildfire.xml:

<pre>
  &lt;ldap&gt;
    ... other ldap settings here
    &lt;initialContextFactory&gt;com.foo.factoryClass&lt;/initialContextFactory&gt;
  &lt;/ldap&gt;</pre>
    </p>

    <p><a name="connectionPool"><h2>Connection Pooling</h2></a></p>

    The default LDAP provider (Sun's) support pooling of connections to the LDAP
    server. Connection pooling can greatly improve performance, especially on
    systems with high load. Connection pooling is enabled by default, but can
    be disabled by setting the Jive property <tt>ldap.connectionPoolEnabled</tt>
    to <tt>false</tt>:

    <pre>&lt;ldap&gt;
        ... other ldap settings here
        &lt;connectionPoolEnabled&gt;false&lt;/connectionPoolEnabled&gt;

        &lt;/ldap&gt;</pre></p>

<p>
    You should set several Java system properties to change default pool settings.
    For more information, see the following pages:
    <ul>

        <li><a href="http://java.sun.com/products/jndi/tutorial/ldap/connect/pool.html">
            http://java.sun.com/products/jndi/tutorial/ldap/connect/pool.html</a>
        <li><a href="http://java.sun.com/products/jndi/tutorial/ldap/connect/config.html">
            http://java.sun.com/products/jndi/tutorial/ldap/connect/config.html</a>

    </ul>
</p>

<p>Note that if you turn on LDAP debugging, connection pooling will not be enabled.
    If SSL LDAP mode is enabled, you must set a system property to enable pooling of
    SSL LDAP connections.</p>

<p><a name="vcard"><h2>LDAP vCard Integration</h2></a></p>

<p>The LDAP vCard provider will expose LDAP profile information as vCard data for XMPP
clients that support the XMPP vCard extension. First, enable the provider:</p>

<pre>
    &lt;provider&gt;

      ...
      &lt;vcard&gt;
        &lt;className&gt;org.jivesoftware.wildfire.ldap.LdapVCardProvider&lt;/className&gt;
      &lt;/vcard&gt;
      ...
    &lt;/provider&gt;
</pre>

<p>Next, you must add mappings between LDAP fields and vCard fields in the wildfire.xml file.
    The vcard attributes are configured by adding an attrs="attr1,attr2" attribute to the vcard
    elements. Arbitrary text can be used for the element values as well as MessageFormat style
    placeholders for the ldap attributes. For example, if you wanted to map the LDAP attribute
    displayName to the vcard element FN, the XML snippet would be:
    &lt;FN attrs="displayName"&gt;{0}&lt;/FN&gt;</p>

<p>The vCard XML must be escaped in CDATA and must also be well formed. It is the exact
    XML this provider will send to a client after after stripping attr attributes and populating
    the placeholders with the data retrieved from LDAP. This system should be flexible enough to
    handle any client's vCard format. An example mapping follows.</p>

<pre>
    &lt;ldap&gt;
      &lt;vcard-mapping&gt;

        &lt;![CDATA[
          &lt;vCard xmlns='vcard-temp'&gt;
            &lt;FN attrs=&quot;displayName&quot;&gt;{0}&lt;/FN&gt;
            &lt;NICKNAME attrs=&quot;uid&quot;&gt;{0}&lt;/NICKNAME&gt;
            &lt;BDAY attrs=&quot;dob&quot;&gt;{0}&lt;/BDAY&gt;

            &lt;ADR&gt;
              &lt;HOME/&gt;
              &lt;EXTADR&gt;Ste 500&lt;/EXTADR&gt;
              &lt;STREET&gt;317 SW Alder St&lt;/STREET&gt;
              &lt;LOCALITY&gt;Portland&lt;/LOCALITY&gt;

              &lt;REGION&gt;Oregon&lt;/REGION&gt;
              &lt;PCODE&gt;97204&lt;/PCODE&gt;
              &lt;CTRY&gt;USA&lt;/CTRY&gt;
            &lt;/ADR&gt;

            &lt;TEL&gt;
              &lt;HOME/&gt;
              &lt;VOICE/&gt;
              &lt;NUMBER attrs=&quot;telephoneNumber&quot;&gt;{0}&lt;/NUMBER&gt;
            &lt;/TEL&gt;

            &lt;EMAIL&gt;
            &lt;INTERNET/&gt;
            &lt;USERID attrs=&quot;mail&quot;&gt;{0}&lt;/USERID&gt;
            &lt;/EMAIL&gt;
            &lt;TITLE attrs=&quot;title&quot;&gt;{0}&lt;/TITLE&gt;

            &lt;ROLE attrs=&quot;&quot;&gt;{0}&lt;/ROLE&gt;
            &lt;ORG&gt;
              &lt;ORGNAME attrs=&quot;o&quot;&gt;{0}&lt;/ORGNAME&gt;
              &lt;ORGUNIT attrs=&quot;&quot;&gt;{0}&lt;/ORGUNIT&gt;

            &lt;/ORG&gt;
            &lt;URL attrs=&quot;labeledURI&quot;&gt;{0}&lt;/URL&gt;
            &lt;DESC attrs=&quot;uidNumber,homeDirectory,loginShell&quot;&gt;
            uid: {0} home: {1} shell: {2}
            &lt;/DESC&gt;

          &lt;/vCard&gt;
        ]]&gt;
      &lt;/vcard-mapping&gt;
    &lt;/ldap&gt;
</pre>

<h2>LDAP FAQ</h2>

<p>

    <b>Can I create new users through Wildfire when using LDAP?</b>
    <ul>No, Wildfire treats LDAP directories as read-only. Therefore, it's
        not possible to create or edit users through the application.</ul>

    <b>Why is the list of usernames not sorted in the admin console when using LDAP?</b>
    <ul>Several popular LDAP servers such as OpenLDAP do not support server-side
        sorting of search results. On those servers, users will appear out of order.
        However, you can enable client-side sorting of search results by setting
        <tt>ldap.clientSideSorting</tt> to true in the XML configuration file.</ul>

    <b>I switched to LDAP and now cannot login to the admin console. What happened?</b>
    <ul>If you can no longer login to the admin console after switching, one of two
        things most likely happened:<ol>
        <li>By default, only the username "admin" is allowed to login to the
            admin console. Your directory may not contain a user with a username
            of "admin". In that case, you should modify the list of usernames authorized
            to login to the admin console (see above).
        <li>You may have set the baseDN to an incorrect value. The LDAP module
            recursively searches for users under the node in the directory specified
            by the baseDN. When the baseDN is incorrect, no users will be found.
    </ol>
        You can also enable debugging to get more information from the LDAP module. To
        do this, add &lt;log&gt;&lt;debug&gt;&lt;enabled&gt;true&lt;/enabled&gt;&lt;/debug&gt;&lt;/log&gt;

        to your <tt>conf/wildfire.xml</tt> file. Log statements will be written
        to the <tt>logs/debug.log</tt> file.
    </ul>


	</div>

</div>

</body>
</html>