Remove references to the "feedback" and the original source of the document (such...
[krb5.git] / doc / rst_source / krb_admins / conf_ldap.rst
1 Configuring Kerberos with OpenLDAP back-end
2 ===========================================
3
4 .. seealso:: :ref:`ldap_be_ubuntu`
5
6 1. Set up SSL on the OpenLDAP server and client to ensure secure
7    communication when the KDC service and LDAP server are on different
8    machines.  ``ldapi\://`` can be used if the LDAP server and KDC
9    service are running on the same machine.
10
11    A. Setting up SSL on the OpenLDAP server:
12
13       i) Get a CA certificate using OpenSSL tools
14       ii) Configure OpenLDAP server for using SSL/TLS
15
16           For the latter, you need to specify the location of CA
17           certificate location in *slapd.conf* file.
18
19           Refer to the following link for more information:
20           http://www.openldap.org/doc/admin23/tls.html
21
22     B. Setting up SSL on OpenLDAP Client:
23
24        i) For the KDC and Admin Server, you need to do the client-side
25           configuration in ldap.conf.  For example::
26
27               TLS_CACERT /etc/openldap/certs/cacert.pem
28
29 2. Include the Kerberos schema file (kerberos.schema) in the
30    configuration file (slapd.conf) on the LDAP Server, by providing
31    the location where it is stored::
32
33        include /etc/openldap/schema/kerberos.schema
34
35 3. Choose DNs for the :ref:`krb5kdc(8)` and :ref:`kadmind(8)` servers
36    to bind to the LDAP server, and create them if necessary. These DNs
37    will be specified with the **ldap_kdc_dn** and **ldap_kadmind_dn**
38    directives in :ref:`krb5.conf(5)`; their passwords can be stashed
39    with "``kdb5_ldap_util stashsrvpw``" and the resulting file
40    specified with the **ldap_service_password_file** directive.
41
42 4. Choose a DN for the global Kerberos container entry (but do not
43    create the entry at this time).  This DN will be specified with the
44    **ldap_kerberos_container_dn** directive in :ref:`krb5.conf(5)`.
45    Realm container entries will be created underneath this DN.
46    Principal entries may exist either underneath the realm container
47    (the default) or in separate trees referenced from the realm
48    container.
49
50 5. Configure the LDAP server ACLs to enable the KDC and kadmin server
51    DNs to read and write the Kerberos data.
52
53    Sample access control information::
54
55        access to dn.base=""
56            by * read
57
58        access to dn.base="cn=Subschema"
59            by * read
60
61        access to attrs=userPassword,userPKCS12
62            by self write
63            by * auth
64
65        access to attrs=shadowLastChange
66            by self write
67            by * read
68
69        # Providing access to realm container
70        access to dn.subtree= "cn=EXAMPLE.COM,cn=krbcontainer,dc=example,dc=com"
71            by dn.exact="cn=kdc-service,dc=example,dc=com" read
72            by dn.exact="cn=adm-service,dc=example,dc=com" write
73            by * none
74
75        # Providing access to principals, if not underneath realm container
76        access to dn.subtree= "ou=users,dc=example,dc=com"
77            by dn.exact="cn=kdc-service,dc=example,dc=com" read
78            by dn.exact="cn=adm-service,dc=example,dc=com" write
79            by * none
80
81        access to *
82            by * read
83
84       If the locations of the container and principals or the DNs of
85       the service objects for a realm are changed then this
86       information should be updated.
87
88 6. Start the LDAP server as follows::
89
90        slapd -h "ldapi:/// ldaps:///"
91
92 7. Modify the :ref:`krb5.conf(5)` file to include LDAP specific items
93    listed below::
94
95        realms
96            database_module
97
98        dbmodules
99            db_library
100            db_module_dir
101            ldap_kdc_dn
102            ldap_kadmind_dn
103            ldap_service_password_file
104            ldap_servers
105            ldap_conns_per_server
106
107 8. Create the realm using :ref:`kdb5_ldap_util(8)` (see
108    :ref:`ldap_create_realm`)::
109
110        kdb5_ldap_util -D cn=admin,dc=example,dc=com create -subtrees ou=users,dc=example,dc=com -r EXAMPLE.COM -s
111
112    Use the **-subtrees** option if the principals are to exist in a
113    separate subtree from the realm container.  Before executing the
114    command, make sure that the subtree mentioned above
115    ``(ou=users,dc=example,dc=com)`` exists.  If the principals will
116    exist underneath the realm container, omit the **-subtrees** option
117    and do not worry about creating the principal subtree.
118
119    For more information, refer to the section :ref:`ops_on_ldap`.
120
121    The realm object is created under the
122    **ldap_kerberos_container_dn** specified in the configuration file.
123    This operation will also create the Kerberos container, if not
124    present already.  This will be used to store information related to
125    all realms.
126
127 9. Stash the password of the service object used by the KDC and
128    Administration service to bind to the LDAP server using the
129    :ref:`kdb5_ldap_util(8)` **stashsrvpw** command (see
130    :ref:`stash_ldap`).  The object DN should be the same as
131    **ldap_kdc*_dn* and **ldap_kadmind_dn** values specified in the
132    :ref:`krb5.conf(5)` file::
133
134        kdb5_ldap_util -D cn=admin,dc=example,dc=com stashsrvpw -f /etc/kerberos/service.keyfile cn=krbadmin,dc=example,dc=com
135
136 10. Add ``krbPrincipalName`` to the indexes in slapd.conf to speed up
137     the access.
138
139 With the LDAP back end it is possible to provide aliases for principal
140 entries.  Currently we provide no mechanism provided for creating
141 aliases, so it must be done by direct manipulation of the LDAP
142 entries.
143
144 An entry with aliases contains multiple values of the
145 *krbPrincipalName* attribute.  Since LDAP attribute values are not
146 ordered, it is necessary to specify which principal name is canonical,
147 by using the *krbCanonicalName* attribute.  Therefore, to create
148 aliases for an entry, first set the *krbCanonicalName* attribute of
149 the entry to the canonical principal name (which should be identical
150 to the pre-existing *krbPrincipalName* value), and then add additional
151 *krbPrincipalName* attributes for the aliases.
152
153 Principal aliases are only returned by the KDC when the client
154 requests canonicalization.  Canonicalization is normally requested for
155 service principals; for client principals, an explicit flag is often
156 required (e.g. ``kinit -C``) and canonicalization is only performed
157 for initial ticket requests.