Dies ist eine alte Version des Dokuments!
Bei Debian wird das Paket mit folgenden Werten vorkonfiguriert 2):
debconf-set-selections <<DEBCONF
# Name of your organization: slapd shared/organization string linuxhotel # Allow LDAPv2 protocol? slapd slapd/allow_ldap_v2 boolean false # DNS domain name: slapd slapd/domain string linuxhotel.de # Admin password: slapd slapd/password1 password villa # Confirm password: slapd slapd/password2 password villa
DEBCONF
Ab Debian 6.0 ( squeeze ) liegt die Konfiguration per default in einem LDAP-Baum. Wir empfehlen LDAP-Einsteigern, slapd über eine Konfigurationsdatei zu konfigurieren:
cat /usr/share/doc/slapd/examples/slapd.conf > /etc/ldap/slapd.conf
/etc/default/slapd
: ( Debian 6.0 )
SLAPD_CONF=/etc/ldap/slapd.conf
Die wichtigsten Einstellungen für slapd
:
/etc/ldap/slapd.conf
: (Debian)
/etc/openldap/slapd.conf
(SuSE, Fedora)
include /etc/openldap/schema/core.schema include /etc/openldap/schema/cosine.schema include /etc/openldap/schema/inetorgperson.schema include /etc/openldap/schema/nis.schema
Je nach Version der Distribution bzw. von OpenLDAP wird ein anderes Backend empfohlen.
Debian 6.0 :
moduleload back_hdb
backend hdb
database hdb
suffix "dc=linuxhotel,dc=de" access to attrs=userPassword by dn="cn=admin,dc=linuxhotel,dc=de" write by anonymous auth by self write by * none access to * by dn="cn=admin,dc=linuxhotel,dc=de" write by self read by * read
centos 5 :
cp /etc/openldap/DB_CONFIG.example /var/lib/ldap/DB_CONFIG
centos 6 :
include /etc/openldap/schema/core.schema include /etc/openldap/schema/cosine.schema include /etc/openldap/schema/inetorgperson.schema include /etc/openldap/schema/nis.schema include /etc/openldap/schema/openldap.schema # modulepath /usr/lib/openldap modulepath /usr/lib64/openldap access to dn.base="" by * read database bdb suffix "dc=example,dc=com" rootdn "cn=admin,dc=example,dc=com" rootpw villa directory /var/lib/ldap
slapd -t slaptest
Unter Debian werden bereits bei der Installation die ersten Werte, wie z.B. der Administrator-Benutzer in das Verzeichnis eingefügt. Unter SuSE und Fedora kann man das mit dem Befehl slapadd
tun, das Administrator-Passwort wird mit dem Befehl slappasswd
erzeugt:
DOMAIN="dc=linuxhotel,dc=de" DC=${DOMAIN%%,*} PASSWORD=`slappasswd -s villa` slapadd <<LDIF
dn: $DOMAIN objectClass: top objectClass: dcObject objectClass: organization o: linuxhotel dc: ${DC#dc=} dn: cn=admin,$DOMAIN objectClass: top objectClass: simpleSecurityObject objectClass: organizationalRole cn: admin description: LDAP administrator userPassword: $PASSWORD
LDIF
SuSE, Centos, Fedora:
/etc/init.d/ldap restart chkconfig ldap on
Debian:
/etc/init.d/slapd restart
(unter SuSE /usr/lib/openldap/slapd)
slapd -d -1
Debian:
ldap-utils
SuSE:
openldap2-client
Fedora, CentOS 6:
openldap-clients
Der OpenLDAP Server sollte nun z.B. mit ldapsearch
die oben eingegebenen Werte zurückliefern:
ldapsearch -x -W -b dc=linuxhotel,dc=de -H ldap://localhost -D cn=admin,dc=linuxhotel,dc=de
Die Benutzung der ldap-utils können sie mit Hilfe einer Konfigurationsdatei $HOME/.ldaprc
3) vereinfachen:
BASE dc=linuxhotel,dc=de BINDDN cn=admin,dc=linuxhotel,dc=de HOST localhost
Der obige Aufruf verkürzt sich dadurch zu:
ldapsearch -x -W
ldapsearch -x -W -b '' -s base '+'
ldapsearch -x -W -b 'cn=Subschema' -s base '+'
/etc/init.d/slapd stop slapcat -b dc=linuxhotel,dc=de > sicherung.ldif less sicherung.ldif grep directory /etc/ldap/slapd.conf # DB_CONFIG nicht löschen ... rm /var/lib/ldap/*.bdb rm /var/lib/ldap/__db.* vi sicherung.ldif slapadd < sicherung.ldif slapindex chown -R openldap:openldap /var/lib/ldap/* /etc/init.d/slapd start
Nützliche Optionen beim Editieren von LDIF Dateien:
:set list
:syntax on
:set number
Oder eine Datei ~/.vimrc
anlegen
set list set number syntax on
LDIF-Dateien vor dem Einfügen testen:
ldapadd -x -W -n < irgendwas.ldif
und erst dann wirklich einfügen:
ldapadd -x -W < irgendwas.ldif