Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
centos:ldap:install [27.10.2011 12:07. ] – [ldap.conf] django | centos:ldap:install [20.04.2018 10:49. ] (aktuell) – Externe Bearbeitung 127.0.0.1 | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
+ | ====== OpenLDAP Server unter CentOS 6.x installieren und einrichten ====== | ||
+ | {{: | ||
+ | |||
+ | Zur zentralen Nutzerdatenverwaltung | ||
+ | |||
+ | LDAP ist ein Netzwerkprotokoll, | ||
+ | |||
+ | ===== Installation ===== | ||
+ | ==== OpenLDAP - Server ==== | ||
+ | Die Installation unseres OpenLDAP-Servers gestaltet sich recht einfach, das das notwendige Programmpaket **openldap-servers** als RPM aus dem Base-Repository unserer CentOS-Installation zur Verfügung gestellt wird. Die Installation selbst erfolgt mit dem Paketverwaltungs-Utility yum von CentOS 6. | ||
+ | # yum install openldap-servers -y | ||
+ | Neben dem Server-Part **openldap-server** werden noch zwei Pakete welches zur Laufzeit des Servers benötigt werden installiert. Was uns die einzelnen Programmpakete mitbringen, erkunden wir bei Bedarf mit der Option **//qil//** beim Programm **rpm**. | ||
+ | === openldap-servers === | ||
+ | # rpm -qil openldap-servers | ||
+ | < | ||
+ | Version | ||
+ | Release | ||
+ | Install Date: Wed 26 Oct 2011 12:52:08 PM CEST Build Host: c6b6.bsys.dev.centos.org | ||
+ | Group : System Environment/ | ||
+ | Size : 6402916 | ||
+ | Signature | ||
+ | Packager | ||
+ | URL : http:// | ||
+ | Summary | ||
+ | Description : | ||
+ | OpenLDAP is an open-source suite of LDAP (Lightweight Directory Access | ||
+ | Protocol) applications and development tools. LDAP is a set of | ||
+ | protocols for accessing directory services (usually phone book style | ||
+ | information, | ||
+ | similar to the way DNS (Domain Name System) information is propagated | ||
+ | over the Internet. This package contains the slapd server and related files. | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | </ | ||
+ | === libtool-ltdl === | ||
+ | # rpm -qil libtool-ltdl | ||
+ | < | ||
+ | Version | ||
+ | Release | ||
+ | Install Date: Wed 26 Oct 2011 12:52:03 PM CEST Build Host: c6b2.bsys.dev.centos.org | ||
+ | Group : System Environment/ | ||
+ | Size : 64948 License: LGPLv2+ | ||
+ | Signature | ||
+ | Packager | ||
+ | URL : http:// | ||
+ | Summary | ||
+ | Description : | ||
+ | The libtool-ltdl package contains the GNU Libtool Dynamic Module Loader, a | ||
+ | library that provides a consistent, portable interface which simplifies the | ||
+ | process of using dynamic modules. | ||
+ | |||
+ | These runtime libraries are needed by programs that link directly to the | ||
+ | system-installed ltdl libraries; they are not needed by software built using | ||
+ | the rest of the GNU Autotools (including GNU Autoconf and GNU Automake). | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | </ | ||
+ | === make === | ||
+ | # rpm -qil make | ||
+ | < | ||
+ | Version | ||
+ | Release | ||
+ | Install Date: Wed 26 Oct 2011 12:52:05 PM CEST Build Host: c6b5.bsys.dev.centos.org | ||
+ | Group : Development/ | ||
+ | Size : 1079569 | ||
+ | Signature | ||
+ | Packager | ||
+ | URL : http:// | ||
+ | Summary | ||
+ | Description : | ||
+ | A GNU tool for controlling the generation of executables and other | ||
+ | non-source files of a program from the program' | ||
+ | allows users to build and install packages without any significant | ||
+ | knowledge about the details of the build process. The details about | ||
+ | how the program should be built are provided for make in the program' | ||
+ | makefile. | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | </ | ||
+ | ==== OpenLDAP - Client ==== | ||
+ | Da wir auf unserem Server später auch auf Hilfsprogramme des openldap-clients zurückgreifen installieren wir auch dieses Paket. | ||
+ | |||
+ | Auch dieses Paket wird mit Hilfe der Paketverwaltungshilfsprogarmmes **yum** installieren. | ||
+ | # yum install openldap-clients -y | ||
+ | Was uns dieses Programmpaket mitbringt, ermitteln wir bei Bedarf mit der Option **//qil//** beim Programm **rpm**. | ||
+ | # rpm -qil openldap-clients | ||
+ | < | ||
+ | Version | ||
+ | Release | ||
+ | Install Date: Wed 26 Oct 2011 01:23:30 PM CEST Build Host: c6b6.bsys.dev.centos.org | ||
+ | Group : Applications/ | ||
+ | Size : 612692 | ||
+ | Signature | ||
+ | Packager | ||
+ | URL : http:// | ||
+ | Summary | ||
+ | Description : | ||
+ | OpenLDAP is an open-source suite of LDAP (Lightweight Directory Access | ||
+ | Protocol) applications and development tools. LDAP is a set of | ||
+ | protocols for accessing directory services (usually phone book style | ||
+ | information, | ||
+ | similar to the way DNS (Domain Name System) information is propagated | ||
+ | over the Internet. The openldap-clients package contains the client | ||
+ | programs needed for accessing and modifying OpenLDAP directories. | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | ===== Konfiguration ===== | ||
+ | Bei der von CentOS 6.x mitgelieferten OpenLDAP Version // | ||
+ | ==== Vorbereitung ==== | ||
+ | Da wir bei der nachfolgenden Konfiguration mit einer frischen eigenen Installation beginnen wollen, werden wir die mitgelieferten Konfigurationsbeispiele erst einmal sichern und unsere Konfigurationspfade entsprechend vorbereiten. | ||
+ | |||
+ | Als erstes sichern wir das originale Konfigurationsverzeichnis, | ||
+ | # cp -ar / | ||
+ | Als nächstes leeren wir das standardmäßig mitgelieferte Konfigurationsverzeichnis // | ||
+ | # rm -rf / | ||
+ | Im nächsten Schritt erstellen wir uns eine neue Konfigurationsdatei // | ||
+ | # cp / | ||
+ | Anschließend passen wir noch die Dateiberechtigungen an: | ||
+ | # chown root:ldap / | ||
+ | |||
+ | Aus sichertstechnischen Gründen soll die Datei **/ | ||
+ | # ls -l / | ||
+ | < | ||
+ | |||
+ | Nachfolgend wollen wir nun auf die unterschiedlichen Konfigurationsverzeichnisse und -dateien im Detail eingehen. | ||
+ | ==== ldap.conf ==== | ||
+ | In der Konfigurationsdatei // | ||
+ | Mit dem Editor unserer Wahl bearbeiten wir nun diese Datei und tragen dort ein: | ||
+ | * **BASE** : Definition des standardmässig abgefragten Teilbaums / Searchbase unter der Anfragen von dc=nausch, dc=org ausgeführt werden sollen. | ||
+ | * **URI** : Definition des LDAP-Servers, | ||
+ | |||
+ | # vim / | ||
+ | <file | / | ||
+ | # LDAP Defaults | ||
+ | # | ||
+ | |||
+ | # See ldap.conf(5) for details | ||
+ | # This file should be world readable but not world writable. | ||
+ | |||
+ | #BASE | ||
+ | #URI ldap:// | ||
+ | |||
+ | # Django: 2011-10-26 | ||
+ | BASE dc=nausch, dc=org | ||
+ | # Anfragen werden unterhalb von dc=nausch, dc=org ausgeführt. | ||
+ | URI | ||
+ | |||
+ | |||
+ | # | ||
+ | # | ||
+ | # | ||
+ | </ | ||
+ | |||
+ | ==== DB_CONFIG ==== | ||
+ | Als Backend-Datenbank für unseren zentralen Verzeichnisdienst nutzen wir eine [[http:// | ||
+ | |||
+ | Bei der Installation unseres **openldap-servers** RPM-Paketes wird uns eine entsprechende Musterkonfigurationsdatei bereits mitgeliefert. Diese muss nur noch an Ort und Stelle kopiert und die Benutzer- und Gruppenrechte angepasst werden. | ||
+ | |||
+ | Als erstes kopieren wir uns die Vorlage Datei in unser Konfigurationsverzeichnis. | ||
+ | # cp / | ||
+ | Anschließend passen wir noch die Benutzer- und Gruppenrechte an. | ||
+ | # chown ldap:ldap / | ||
+ | Eine weitere Bearbeitung der nun vorliegenden Konfigurationsdatei DB_CONFIG ist nicht notwendig, die Datei kann 1:1 so verwendet werden, wie diese aus dem RPM gefallen ist. | ||
+ | <file | / | ||
+ | # $OpenLDAP: pkg/ | ||
+ | # Example DB_CONFIG file for use with slapd(8) BDB/HDB databases. | ||
+ | # | ||
+ | # See the Oracle Berkeley DB documentation | ||
+ | # < | ||
+ | # for detail description of DB_CONFIG syntax and semantics. | ||
+ | # | ||
+ | # Hints can also be found in the OpenLDAP Software FAQ | ||
+ | # | ||
+ | # in particular: | ||
+ | # < | ||
+ | |||
+ | # Note: most DB_CONFIG settings will take effect only upon rebuilding | ||
+ | # the DB environment. | ||
+ | |||
+ | # one 0.25 GB cache | ||
+ | set_cachesize 0 268435456 1 | ||
+ | |||
+ | # Data Directory | ||
+ | # | ||
+ | |||
+ | # Transaction Log settings | ||
+ | set_lg_regionmax 262144 | ||
+ | set_lg_bsize 2097152 | ||
+ | #set_lg_dir logs | ||
+ | |||
+ | # Note: special DB_CONFIG flags are no longer needed for " | ||
+ | # slapadd(8) or slapindex(8) access (see their -q option). | ||
+ | </ | ||
+ | |||
+ | ==== Master-Passwort erstellen ==== | ||
+ | Für den administrativen Zugriff wird ein eigenes Rootpasswort **rootpw** benötigt. Zur Generierung dieses Passwortes mit der Verschlüsselungsmethode SSHA - entsprechend einem SHA-1 Algorithmus (FIPS 160-1), nutzen wird das Programm / | ||
+ | # / | ||
+ | |||
+ | New password: | ||
+ | | ||
+ | | ||
+ | |||
+ | ==== slapd.conf ==== | ||
+ | Die eigentliche Konfiguration unseres OpenLDAP-Daemons erfolgt mit Hilfe der Konfigurationsdatei **slapd.conf** im Verzeichnis **/ | ||
+ | Die Konfigurationsdatei bearbeiten wir nun mit dem Editor unserer Wahl, z.B. **vim**. | ||
+ | # vim / | ||
+ | <file | / | ||
+ | # | ||
+ | # See slapd.conf(5) for details on configuration options. | ||
+ | # This file should NOT be world readable. | ||
+ | # | ||
+ | |||
+ | # Django : 2011-10-26 unbenutzte Schematas deaktiviert | ||
+ | # | ||
+ | include / | ||
+ | include / | ||
+ | # | ||
+ | # | ||
+ | include / | ||
+ | # | ||
+ | # | ||
+ | include / | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | |||
+ | # Allow LDAPv2 client connections. | ||
+ | allow bind_v2 | ||
+ | |||
+ | # Do not enable referrals until AFTER you have a working directory | ||
+ | # service AND an understanding of referrals. | ||
+ | # | ||
+ | # Django : 2011-10-26 | ||
+ | referral ldap:// | ||
+ | |||
+ | pidfile / | ||
+ | argsfile / | ||
+ | |||
+ | # Django : 2011-10-26 Definition des Loglevels - Detaillierte Hinweise sind in der manpage zu slapd.conf | ||
+ | # unter loglevel zu finden. | ||
+ | # no default entry for: loglevel | ||
+ | loglevel 256 | ||
+ | |||
+ | # Django : 2011-10-26 Definition der Idle-Timeout Detaillierte Hinweise sind in der manpage zu slapd.conf | ||
+ | # unter idletimeout zu finden. | ||
+ | # no default entry for: idletimeout | ||
+ | idletimeout 15 | ||
+ | |||
+ | # Django : 2011-10-26 Definition des Passwort-Hashes | ||
+ | # unter password-hash zu finden. | ||
+ | # the default entry for password-hash is {SSHA} | ||
+ | password-hash {SSHA} | ||
+ | |||
+ | # Load dynamic backend modules: | ||
+ | # Module syncprov.la is now statically linked with slapd and there | ||
+ | # is no need to load it here | ||
+ | # modulepath / | ||
+ | # moduleload accesslog.la | ||
+ | # moduleload auditlog.la | ||
+ | ## To load this module, you have to install openldap-server-sql first | ||
+ | # moduleload back_sql.la | ||
+ | ## Following two modules can't be loaded simultaneously | ||
+ | # moduleload dyngroup.la | ||
+ | # moduleload dynlist.la | ||
+ | # moduleload lastmod.la | ||
+ | # moduleload pcache.la | ||
+ | # moduleload ppolicy.la | ||
+ | # moduleload refint.la | ||
+ | # moduleload retcode.la | ||
+ | # moduleload rwm.la | ||
+ | # moduleload translucent.la | ||
+ | # moduleload unique.la | ||
+ | # moduleload valsort.la | ||
+ | |||
+ | # Django : 2011-10-25 Detaillierte Hinweise sind in der manpage zu slapd.conf | ||
+ | # unter modulepath zu finden. | ||
+ | # The default is / | ||
+ | modulepath / | ||
+ | |||
+ | # The next three lines allow use of TLS for encrypting connections using a | ||
+ | # dummy test certificate which you can generate by changing to | ||
+ | # / | ||
+ | # slapd.pem so that the ldap user or group can read it. Your client software | ||
+ | # may balk at self-signed certificates, | ||
+ | # TLSCACertificateFile / | ||
+ | # TLSCertificateFile / | ||
+ | # TLSCertificateKeyFile / | ||
+ | |||
+ | # Sample security restrictions | ||
+ | # Require integrity protection (prevent hijacking) | ||
+ | # Require 112-bit (3DES or better) encryption for updates | ||
+ | # Require 63-bit encryption for simple bind | ||
+ | # security ssf=1 update_ssf=112 simple_bind=64 | ||
+ | |||
+ | # Sample access control policy: | ||
+ | # Root DSE: allow anyone to read it | ||
+ | # Subschema (sub)entry DSE: allow anyone to read it | ||
+ | # Other DSEs: | ||
+ | # Allow self write access | ||
+ | # Allow authenticated users read access | ||
+ | # Allow anonymous users to authenticate | ||
+ | # | ||
+ | # access to dn.base="" | ||
+ | # access to dn.base=" | ||
+ | # access to * | ||
+ | # by self write | ||
+ | # by users read | ||
+ | # by anonymous auth | ||
+ | # | ||
+ | # if no access controls are present, the default policy | ||
+ | # allows anyone and everyone to read anything but restricts | ||
+ | # updates to rootdn. | ||
+ | # | ||
+ | # rootdn can always read and write EVERYTHING! | ||
+ | |||
+ | # Django : 2011-10-26 | ||
+ | # no default entry for: Access Control Lists (ACLs) | ||
+ | access to attrs=userPassword | ||
+ | by self write | ||
+ | by dn=" | ||
+ | by anonymous auth | ||
+ | by * none | ||
+ | access to * | ||
+ | by self write | ||
+ | by dn=" | ||
+ | by * read | ||
+ | |||
+ | ####################################################################### | ||
+ | # ldbm and/or bdb database definitions | ||
+ | ####################################################################### | ||
+ | |||
+ | # Django : 2011-10-26 | ||
+ | # Make cn=config accessable | ||
+ | database config | ||
+ | rootdn " | ||
+ | rootpw {SSHA}MT/ | ||
+ | |||
+ | database bdb | ||
+ | # Django : 2011-10-26 | ||
+ | # default : suffix | ||
+ | suffix " | ||
+ | checkpoint 1024 15 | ||
+ | # Django : 2011-10-26 | ||
+ | # # default : rootdn | ||
+ | rootdn " | ||
+ | # Cleartext passwords, especially for the rootdn, should | ||
+ | # be avoided. | ||
+ | # Use of strong authentication encouraged. | ||
+ | # rootpw secret | ||
+ | # rootpw {crypt}ijFYNcSNctBYg | ||
+ | # Django : 2011-10-26 | ||
+ | rootpw | ||
+ | |||
+ | # The database directory MUST exist prior to running slapd AND | ||
+ | # should only be accessible by the slapd and slap tools. | ||
+ | # Mode 700 recommended. | ||
+ | directory / | ||
+ | |||
+ | # Django : 2011-10-26 | ||
+ | # no default entry for: mode | ||
+ | mode 0600 | ||
+ | |||
+ | # Django : 2011-10-26 | ||
+ | # no default entry for: lastmod | ||
+ | lastmod on | ||
+ | |||
+ | # Indices to maintain for this database | ||
+ | index objectClass | ||
+ | index ou, | ||
+ | index uidNumber, | ||
+ | index uid, | ||
+ | index nisMapName, | ||
+ | |||
+ | # Replicas of this database | ||
+ | #replogfile / | ||
+ | #replica host=ldap-1.example.com: | ||
+ | # | ||
+ | # | ||
+ | |||
+ | |||
+ | # enable monitoring | ||
+ | database monitor | ||
+ | |||
+ | # allow onlu rootdn to read the monitor | ||
+ | # Django : 2011-10-26 | ||
+ | # default : by dn.exact=" | ||
+ | access to * | ||
+ | by dn.exact=" | ||
+ | by * none | ||
+ | </ | ||
+ | Die Parameter sind in der Manpage der Konfigurationsdatei **slapd.conf** ausreichend beschrieben. | ||
+ | # man slapd.conf | ||
+ | Auf die wichtigsten wollen wir noch kurz eingehen. | ||
+ | * **idletimeout** Der Wert für den Eintrag idletimeout setzte eine Ablaufzeit für offene Abfragen, welche noch nicht beendet wurden. Das Setzen dieses Wertes wird dringendst angeraten, da es sonst bei sehr vielen Abfragen zu einem „Stillstand“ des LDAP-Servers kommen könnte. | ||
+ | * **password-hash** Dieser Wert setzt den Standard-Agorithmus //SSHA// für den Eintrag des Passwort-Hashes. | ||
+ | * **ACLs**((**A**ccess **C**ontrol **L**ists)) Die erste der beide ACLs definiert den Zugriff auf das Attribut // | ||
+ | by self write | ||
+ | by dn=" | ||
+ | by anonymous auth | ||
+ | by * none</ | ||
+ | by self write | ||
+ | by dn=" | ||
+ | by * read</ | ||
+ | * **rootpw** Hier ist das LDAP-RootPasswort für den administrativen Zugang, welches wir uns eingangs im Abschnitt [[centos: | ||
+ | * **mode** Der Eintrag mode mit der entsprechenden Angabe 0600 legt fest, dass Dateien mit nur für den Eigentümer der Datei mit den Rechten **rw** angelegt werden. | ||
+ | * **lastmode** Durch das Setzen des Wertes **on** wird festgelegt, daß Einträge mit einem Datum zu versehen sind. | ||
+ | ==== ldif Konfiguration ==== | ||
+ | Im nächsten Schritt werden wir nun unsere zuvor angelegt Konfigurationsdatei // | ||
+ | Mit folgendem Aufruf generieren wir die ldif-Verzeichnisstrukturen sowie die zugehörigen ldif-Dateien. | ||
+ | # slaptest -f / | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | <WRAP round important> | ||
+ | |||
+ | Annschließend passen wir noch die Verzeichnis- und Dateirechte der gerade erzeigten Daten an: | ||
+ | # chown -R ldap:ldap / | ||
+ | |||
+ | <WRAP round alert> | ||
+ | Diese Berkley-Datenbankstruktur wurde jedoch nicht vom **slapd-Daemon** erstellt, und ist somit wieder zu entfernen, da es sonst zu unerwünschten Fehlern beim Starten und beim Betrieb des OpenLDAP-Server kömmen würde. | ||
+ | Wir löschen alos dies Dateien mit folgendem Befehl. | ||
+ | # rm -f / | ||
+ | </ | ||
+ | Da wir zukünftig die weitere Konfiguration unseres OpenLDAP-Servers ausschließlich mit Hilfe der ldif-Dateien vornehmen wollen, werden wir nun unsere Konfigurationsdatei, | ||
+ | # mv / | ||
+ | |||
+ | ==== rsyslog ==== | ||
+ | Damit unser LDAP-Server seine Meldungen auch sichtbar uns zur Verfügung stellt, lassen wir ihm diese ganz einfach in ein separates Logfile schreiben. Hierzu passen die Konfigurationsdatei **/ | ||
+ | # vim / | ||
+ | < | ||
+ | |||
+ | ... | ||
+ | |||
+ | # Django : 2011-10-26 Logging für OpenLDAP-Server aktiviert | ||
+ | local4.* | ||
+ | |||
+ | ... | ||
+ | </ | ||
+ | Anschließend müssen wir den rsyslog-Daemon einmal durchstarten, | ||
+ | # service rsyslog restart | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | ==== logrotate ==== | ||
+ | Bei einem unter Last stehendem OpenLDAP-Datenbankserver kann unter Umständen das zugehörige Logfile // | ||
+ | # vim / | ||
+ | <file | / | ||
+ | rotate 4 | ||
+ | weekly | ||
+ | compress | ||
+ | notifempty | ||
+ | size 5M | ||
+ | missingok | ||
+ | create 0640 ldap ldap | ||
+ | sharedscripts | ||
+ | postrotate | ||
+ | /bin/kill -HUP `cat / | ||
+ | endscript | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ===== Systemstart ===== | ||
+ | ==== erster manueller Start ==== | ||
+ | Bevor wir nun unseren OpenLDAP-Server das erste mal starten, überprüfen wir noch mit einem **configcheck** ob der ldap-Daemon mit unserem gerade erzeugten Konfigurationsparametern umgehen kann, oder ob es noch nicht entdeckte Fehler in der Konfiguration gibt. | ||
+ | # service slapd configtest | ||
+ | <WRAP round tip> | ||
+ | Nun können wir unseren LDAP-Server das erste mal anstarten: | ||
+ | # service slapd start | ||
+ | |||
+ | | ||
+ | |||
+ | Der erfolgreiche Start unseres slapd-Daemon wird uns, Dank der Änderungen am [[centos: | ||
+ | Oct 26 23:49:54 vml000030 slapd[2023]: | ||
+ | Oct 26 23:49:54 vml000030 slapd[2024]: | ||
+ | |||
+ | |||
+ | Ob der Daemon läuft überprüfen wir am einfachsten mit folgender Abfrage: | ||
+ | # netstat -tulpen | grep slapd | ||
+ | |||
+ | | ||
+ | |||
+ | ==== automatisches Starten des Dienstes beim Systemstart ==== | ||
+ | Damit nun unser OpenLDAP-Datenbankserver beim Booten automatisch gestartet wird, nehmen wir noch folgende Konfigurationsschritte vor. | ||
+ | # chkconfig slapd on | ||
+ | Anschließend überprüfen wir noch unsere Änderung: | ||
+ | # chkconfig --list | grep slapd | ||
+ | |||
+ | | ||
+ | |||
+ | ===== erste LDAP-Abfragen ===== | ||
+ | Mit nachfolgendem Befehl, kann eine erste Suchanfrage, | ||
+ | # ldapsearch -x -b " | ||
+ | Als Ergebnis bekommen folgende Antwort. | ||
+ | < | ||
+ | # extended LDIF | ||
+ | # | ||
+ | # LDAPv3 | ||
+ | # base < | ||
+ | # filter: (objectclass=*) | ||
+ | # requesting: ALL | ||
+ | # | ||
+ | |||
+ | # search result | ||
+ | search: 2 | ||
+ | result: 32 No such object | ||
+ | |||
+ | # numResponses: | ||
+ | </ | ||
+ | im Logfile des slapd-Daemon wird unsere Anfrage entsprechend protokolliert. | ||
+ | < | ||
+ | Oct 27 00:02:28 vml000030 slapd[2024]: | ||
+ | Oct 27 00:02:28 vml000030 slapd[2024]: | ||
+ | Oct 27 00:02:28 vml000030 slapd[2024]: | ||
+ | Oct 27 00:02:28 vml000030 slapd[2024]: | ||
+ | Oct 27 00:02:28 vml000030 slapd[2024]: | ||
+ | Oct 27 00:02:28 vml000030 slapd[2024]: | ||
+ | </ | ||
+ | |||
+ | Für den Zugriff auf den **cn=config** hatten wir bei der erstmaligen Konfiguration folgendes angegeben. | ||
+ | < | ||
+ | # Make cn=config accessable | ||
+ | database config | ||
+ | rootdn " | ||
+ | rootpw {SSHA}MT/ | ||
+ | </ | ||
+ | Mit Hilfe dieser Definition können wir nun ebenfalls die im *.LDIF-Format hinterlegten OpenLDAP-Server-Konfigurationen mit nachfolgendem Befehl abgefragt werden. | ||
+ | Im folgenden Beispiel erfolgt die Abfrage des Konfigurationsabschnitt **cn=config „objectclass=olcGlobal“**. | ||
+ | # ldapsearch -W -x -D cn=config -b cn=config " | ||
+ | |||
+ | < | ||
+ | # extended LDIF | ||
+ | # | ||
+ | # LDAPv3 | ||
+ | # base < | ||
+ | # filter: (objectclass=olcGlobal) | ||
+ | # requesting: ALL | ||
+ | # | ||
+ | |||
+ | # config | ||
+ | dn: cn=config | ||
+ | objectClass: | ||
+ | cn: config | ||
+ | olcConfigFile: | ||
+ | olcConfigDir: | ||
+ | olcAllows: bind_v2 | ||
+ | olcArgsFile: | ||
+ | olcAttributeOptions: | ||
+ | olcAuthzPolicy: | ||
+ | olcConcurrency: | ||
+ | olcConnMaxPending: | ||
+ | olcConnMaxPendingAuth: | ||
+ | olcGentleHUP: | ||
+ | olcIdleTimeout: | ||
+ | olcIndexSubstrIfMaxLen: | ||
+ | olcIndexSubstrIfMinLen: | ||
+ | olcIndexSubstrAnyLen: | ||
+ | olcIndexSubstrAnyStep: | ||
+ | olcIndexIntLen: | ||
+ | olcLocalSSF: | ||
+ | olcLogLevel: | ||
+ | olcPidFile: / | ||
+ | olcReadOnly: | ||
+ | olcReferral: | ||
+ | olcReverseLookup: | ||
+ | olcSaslSecProps: | ||
+ | olcSockbufMaxIncoming: | ||
+ | olcSockbufMaxIncomingAuth: | ||
+ | olcThreads: 16 | ||
+ | olcTLSCRLCheck: | ||
+ | olcTLSVerifyClient: | ||
+ | olcToolThreads: | ||
+ | olcWriteTimeout: | ||
+ | |||
+ | # search result | ||
+ | search: 2 | ||
+ | result: 0 Success | ||
+ | |||
+ | # numResponses: | ||
+ | # numEntries: 1 | ||
+ | </ | ||
+ | Auch hier wird die Abfrage im Logfile des OpenLDAP-Servers protokolliert. | ||
+ | < | ||
+ | Oct 27 00:04:46 vml000030 slapd[2024]: | ||
+ | Oct 27 00:04:46 vml000030 slapd[2024]: | ||
+ | Oct 27 00:04:46 vml000030 slapd[2024]: | ||
+ | Oct 27 00:04:46 vml000030 slapd[2024]: | ||
+ | Oct 27 00:04:46 vml000030 slapd[2024]: | ||
+ | Oct 27 00:04:46 vml000030 slapd[2024]: | ||
+ | Oct 27 00:04:46 vml000030 slapd[2024]: | ||
+ | </ | ||
+ | Nachfolgend wird der Konfigurationsabschnitt **olcDatabase={0}config.ldif** abgefragt: | ||
+ | # ldapsearch -W -x -D cn=config -b olcDatabase={0}config, | ||
+ | |||
+ | < | ||
+ | # extended LDIF | ||
+ | # | ||
+ | # LDAPv3 | ||
+ | # base < | ||
+ | # filter: (objectclass=*) | ||
+ | # requesting: ALL | ||
+ | # | ||
+ | |||
+ | # {0}config, config | ||
+ | dn: olcDatabase={0}config, | ||
+ | objectClass: | ||
+ | olcDatabase: | ||
+ | olcAccess: {0}to * by * none | ||
+ | olcAddContentAcl: | ||
+ | olcLastMod: TRUE | ||
+ | olcMaxDerefDepth: | ||
+ | olcReadOnly: | ||
+ | olcRootDN: cn=config | ||
+ | olcRootPW: {SSHA}MT/ | ||
+ | olcMonitoring: | ||
+ | |||
+ | # search result | ||
+ | search: 2 | ||
+ | result: 0 Success | ||
+ | |||
+ | # numResponses: | ||
+ | # numEntries: 1 | ||
+ | </ | ||
+ | Der Ausschnitt aus dem Logfile zeigt den erfolgreichen Abfrageversuch. | ||
+ | < | ||
+ | Oct 26 23:54:58 vml000030 slapd[2024]: | ||
+ | Oct 26 23:54:58 vml000030 slapd[2024]: | ||
+ | Oct 26 23:54:58 vml000030 slapd[2024]: | ||
+ | Oct 26 23:54:58 vml000030 slapd[2024]: | ||
+ | Oct 26 23:54:58 vml000030 slapd[2024]: | ||
+ | Oct 26 23:54:58 vml000030 slapd[2024]: | ||
+ | Oct 26 23:54:58 vml000030 slapd[2024]: | ||
+ | </ | ||
+ | |||
+ | Natürlich kann man auch den gesamten LDAP-Baum abfragen: | ||
+ | # ldapsearch -W -x -D cn=config -b cn=config | ||
+ | Auch diese Abfrage, bei der wir auf Grund der Fülle an Informationen auf eine Ausgabe hier im Wiki verzichten, wird im Logfile protokolliert. | ||
+ | < | ||
+ | Oct 27 00:07:22 vml000030 slapd[2024]: | ||
+ | Oct 27 00:07:22 vml000030 slapd[2024]: | ||
+ | Oct 27 00:07:22 vml000030 slapd[2024]: | ||
+ | Oct 27 00:07:22 vml000030 slapd[2024]: | ||
+ | Oct 27 00:07:22 vml000030 slapd[2024]: | ||
+ | Oct 27 00:07:22 vml000030 slapd[2024]: | ||
+ | Oct 27 00:07:22 vml000030 slapd[2024]: | ||
+ | </ | ||
+ | Bei den // | ||
+ | |||
+ | Eine Auflistung der gängigen Rückmeldecodes ist [[http:// | ||
+ | ====== Links ====== | ||
+ | * **[[centos: | ||
+ | * **[[wiki: | ||
+ | * **[[http:// | ||
+ | |||