Imported Upstream version 1.15.1
[platform/upstream/krb5.git] / doc / admin / advanced / ldapbackend.rst
1 .. _ldap_be_ubuntu:
2
3 LDAP backend on Ubuntu 10.4 (lucid)
4 ===================================
5
6 Setting up Kerberos v1.9 with LDAP backend on Ubuntu 10.4 (Lucid Lynx)
7
8
9 Prerequisites
10 -------------
11
12 Install the following packages: *slapd, ldap-utils* and *libldap2-dev*
13
14 You can install the necessary packages with these commands::
15
16     sudo apt-get install slapd
17     sudo apt-get install ldap-utils
18     sudo apt-get install libldap2-dev
19
20 Extend the user schema using schemas from standart OpenLDAP
21 distribution: *cosine, mics, nis, inetcomperson* ::
22
23     ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/cosine.ldif
24     ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/mics.ldif
25     ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/nis.ldif
26     ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/inetcomperson.ldif
27
28
29 Building Kerberos from source
30 -----------------------------
31
32 ::
33
34     ./configure --with-ldap
35     make
36     sudo make install
37
38
39 Setting up Kerberos
40 -------------------
41
42 Configuration
43 ~~~~~~~~~~~~~
44
45 Update kdc.conf with the LDAP back-end information::
46
47     [realms]
48         EXAMPLE.COM = {
49             database_module = LDAP
50         }
51
52     [dbmodules]
53         LDAP = {
54             db_library = kldap
55             ldap_kerberos_container_dn = cn=krbContainer,dc=example,dc=com
56             ldap_kdc_dn = cn=admin,dc=example,dc=com
57             ldap_kadmind_dn = cn=admin,dc=example,dc=com
58             ldap_service_password_file = /usr/local/var/krb5kdc/admin.stash
59             ldap_servers = ldapi:///
60         }
61
62
63 Schema
64 ~~~~~~
65
66 From the source tree copy
67 ``src/plugins/kdb/ldap/libkdb_ldap/kerberos.schema`` into
68 ``/etc/ldap/schema``
69
70 Warning: this step should be done after slapd is installed to avoid
71 problems with slapd installation.
72
73 To convert kerberos.schema to run-time configuration (``cn=config``)
74 do the following:
75
76 #. Create a temporary file ``/tmp/schema_convert.conf`` with the
77    following content::
78
79        include /etc/ldap/schema/kerberos.schema
80
81 #. Create a temporary directory ``/tmp/krb5_ldif``.
82
83 #. Run::
84
85        slaptest -f /tmp/schema_convert.conf -F /tmp/krb5_ldif
86
87    This should in a new file named
88    ``/tmp/krb5_ldif/cn=config/cn=schema/cn={0}kerberos.ldif``.
89
90 #. Edit ``/tmp/krb5_ldif/cn=config/cn=schema/cn={0}kerberos.ldif`` by
91    replacing the lines::
92
93        dn: cn={0}kerberos
94        cn: {0}kerberos
95
96    with
97
98        dn: cn=kerberos,cn=schema,cn=config
99        cn: kerberos
100
101    Also, remove following attribute-value pairs::
102
103        structuralObjectClass: olcSchemaConfig
104        entryUUID: ...
105        creatorsName: cn=config
106        createTimestamp: ...
107        entryCSN: ...
108        modifiersName: cn=config
109        modifyTimestamp: ...
110
111 #. Load the new schema with ldapadd (with the proper authentication)::
112
113        ldapadd -Y EXTERNAL -H ldapi:/// -f  /tmp/krb5_ldif/cn=config/cn=schema/cn={0}kerberos.ldif
114
115    which should result the message ``adding new entry
116    "cn=kerberos,cn=schema,cn=config"``.
117
118
119 Create Kerberos database
120 ------------------------
121
122 Using LDAP administrator credentials, create Kerberos database and
123 master key stash::
124
125     kdb5_ldap_util -D cn=admin,dc=example,dc=com -H ldapi:/// create -s
126
127 Stash the LDAP administrative passwords::
128
129     kdb5_ldap_util -D cn=admin,dc=example,dc=com -H ldapi:/// stashsrvpw cn=admin,dc=example,dc=com
130
131 Start :ref:`krb5kdc(8)`::
132
133     krb5kdc
134
135 To destroy database run::
136
137     kdb5_ldap_util -D cn=admin,dc=example,dc=com -H ldapi:/// destroy -f
138
139
140 Useful references
141 -----------------
142
143 * `Kerberos and LDAP <https://help.ubuntu.com/10.04/serverguide/C/kerberos-ldap.html>`_