168 The Virtualization Cookbook for Red Hat Enterprise Linux 5.2
Now it is time to populate the LDAP server. This can be done while the server is not running
using the slapadd -l command. First stop the LDAP service, then add the data in the LDIF
file:
# service ldap stop
Stopping slapd: [ OK ]
# slapadd -l accounts.ldif
bdb_db_open: Warning - No DB_CONFIG file found in directory /var/lib/ldap: (2)
Expect poor performance for suffix dc=itso,dc=ibm,dc=com.
The database is stored in the directory /var/lib/ldap/. For the OpenLDAP server to start, all
files in this directory must be owned by the ldap user and group. This can be accomplished
using the chown command:
# chown ldap:ldap /var/lib/ldap/*
Set the LDAP server:
# service ldap start
Checking configuration files for slapd: bdb_db_open: Warning - No DB_CONFIG file found
in directory /var/lib/ldap: (2)
config file testing succeeded
[ OK ]
Starting slapd: [ OK ]
The message Expect poor performance for suffix dc=itso,dc=ibm,dc=com. is left as an
exercise for the reader. Test that you can query the LDAP directory for ldapuser1 using the
ldapsearch command. The -b flag sets the base of the search (it is necessary because the
default suffix of dc=itso,dc=ibm,dc=com has not been configured into the LDAP client; later it
will not be needed):
# ldapsearch -x -b dc=itso,dc=ibm,dc=com uid=ldapuser1
# extended LDIF
#
# LDAPv3
# base <dc=itso,dc=ibm,dc=com> with scope subtree
# filter: uid=ldapuser1
# requesting: ALL
#
# ldapuser1, People, itso.ibm.com
dn: uid=ldapuser1,ou=People,dc=itso,dc=ibm,dc=com
uid: ldapuser1
...
# numEntries: 1
You should now have an OpenLDAP server installed, configured, and populated with users
and groups.
Deleting duplicate users
You now have a duplicate set of users and groups in both the /etc/ file system and in LDAP.
There are different ways that you can manage this duplication. For this section, the following
changes are recommended:
Delete ldapuser1 from file system: this user was designed to be the first LDAP uid so it
should not also be in the file system
Delete root from LDAP: having uid of 0 (root) in LDAP is may not be a good security
design.
Komentarze do niniejszej Instrukcji