![]() | Upline: Infos & Dokus
Administration
Linux
OpenLDAP - Fehler und Problemlösungen
Problemlösung Das Löschen und Neuanlegen der LDAP-Datenbank stellt kein besonderes Problem dar. Einziger Knackpunkt sind die Inhalte, von denen es hoffentlich auch eine Fassung als ldif gibt. Der bedachte Admin sollte über die entsprechenden Dateien verfügen. Die "Standard"-Befehle, um das Problem zu lösen: # /etc/init.d/slapd stop # rm -r /var/lib/ldap/* # /etc/init.d/slapd start # slapadd -f /etc/ldap/slapd.conf -l /etc/ldap/ldif/initial.ldifJetzt müssen nur noch die restlichen Daten per slapadd eingespielt werden ... Problemlösung Als ersten Versuch, dem Problem beizukommen führte ich ein "apt-get remove slapd" aus. Hierbei bleiben jedoch alle Einstellungen im System und die Konfigurationsdateien erhalten, so daß ein "apt-get install slapd" anschließend wieder zur gleichen Fehlermeldung führt. Da auch ein "dpkg-reconfigure slapd" mit dem Kommentar abgetan wird, daß Einstellungen nur bei der Erstinstallation vorgenommen werden können, nahm ich mir jetzt die Datei "/var/lib/dpkg/info/slapd.postinst" vor, und fügte vor dem "exit 1" ein paar Zeilen ein, in denen ich per echo die Variablen $dn, $admin, $method, $top, $key, $value und $class ausgeben. Da nahezu alle Variablen den gleichen Inhalt hatten (proteino.local) und $class leer war, war der Abbruch nicht weiter verwunderlich und ich wußte jetzt zumindest, an welcher Stelle ich den Fehler verursacht hatte. Bei der Erstinstallation wird man gefragt, was man für eine Struktur anlegen möchte, ich wählte den letzten Punkt und gab meine lokale Domain proteino.local ein. Ich gehe davon aus, daß hier die LDAP-Schreibweise als kompletter Distinguished Name gefragt war, daß stand nur leider nicht in dem Menü ;o) Mit dieser Idee ist man der Lösung des Problems schon sehr nahe, doch erstmal noch ein kleiner Tip für Probierfreudige: Ein Löschen der Konfigurations- und Schemadateien unter "/etc/ldap" kann ich nicht empfehlen, da ein anschließendes "apt-get install slapd" diese nicht wiederherstellt und man die Dateien dann per "dpkg -X /var/cache/apt/archives/<slapd_Version> /tmp" aus dem Debianpaket selbst wieder entpacken muß. Des weiteren bleiben die (fehlerhaften) Einstellungen erhalten - ein Teil davon steht in der slapd.conf und der Rest - mhh, keine Ahnung. Aus der Idee mit dem fehlerhaften dn und der ohnehin nötigen Neuerstellung der "/etc/ldap/slapd.conf" las ich mir dann mal ein paar Zeilen der Originaldokumentation von OpenLDAP.org durch und paßte die "suffix"-Zeile entsprechend an. Weiterhin sollte man natürlich die Zeilen rootdn und rootpw nicht vergessen, sonst hat man keinen Zugriff auf die Datenbank. Ein anschließendes "apt-get install slapd" brachte dann nur noch die Fehlermeldung, daß die Datei "/etc/exim/exim.conf" nicht gefunden werden konnte. Mit "dpkg-reconfigure exim", der Wahl der lokalen Zustellung (Punkt 4) und der Beantwortung von ein paar weiteren kleinen Abfragen war das Problem schnell behoben. Siehe da, der slapd lief jetzt problemlos ... /etc/init.d/slapd /etc/ldap/schema/corba.schema /etc/ldap/schema/core.schema /etc/ldap/schema/cosine.schema /etc/ldap/schema/inetorgperson.schema /etc/ldap/schema/java.schema /etc/ldap/schema/krb5-kdc.schema /etc/ldap/schema/misc.schema /etc/ldap/schema/nis.schema /etc/ldap/schema/openldap.schema/var/lib/dpkg/info/slapd.config
#!/usr/bin/perl
# Bugger, we need to do some things like generate password hashes that
# we can't do from a shell without adding extra dependencies
use Debconf::Client::ConfModule ':all';
version("2.0");
$slapdconf = "/etc/ldap/slapd.conf";
########################################################################
# Utility stuff
sub GenRandom {
local ($len) = @_;
local ($char, $data, @chars);
@chars=split(//, "abcdefghijklmnopqrstuvwxyzaABCDEFGHIJKLMNOPQRSTUVWXYZA01234567890");
open(RD, "</dev/urandom") or die "Failed to open random source";
$data="";
while ($len--) {
die "Failed to read random data" if (read(RD, $char, 1)!=1);
$data.=$chars[ord($char)%($#chars+1)];
}
close(RD);
return $data;
}
########################################################################
# Initialize the database using a user supplied LDIF file
sub InitializeFromLdif() {
local($file, $ok);
$ok=0;
while ($ok!=30) {
beginblock;
$ok=(input("medium", "slapd/ldif_file"))[0];
input("medium", "slapd/internal/dn");
input("medium", "slapd/internal/admin");
endblock;
go;
$file=get("slapd/ldif_file");
if ($ok!=30 and not -f $file) {
fset("slapd/ldif_noexist", "seen", "false");
subst("slapd/ldif_noexist", "ldif", $file);
input("medium", "slapd/ldif_noexist");
go;
} else {
$ok=30;
}
}
}
########################################################################
# Initialize the database using user input
sub InitializeFromInput() {
local($type,$domain,$dn,$admin,$ret);
input("medium", "slapd/suffix_type");
go;
$type=get("slapd/suffix_type");
if ($type eq "domain or host") {
if (fget("slapd/domain", "seen") eq "false") {
chomp($domain=`hostname -f`);
$domain=~s/[^.]+\.(.*)/\1/;
set("slapd/domain", $domain);
}
input("medium", "slapd/domain");
go;
$dn="dc=" . join(",dc=", split(/\./, get("slapd/domain")));
$admin="cn=admin,$dn";
} elsif ($type eq "location") {
beginblock;
input("medium", "shared/locale/countrycode");
input("medium", "shared/organization");
endblock;
go;
$dn=sprintf("o=%s,c=%s",
(get("shared/organization"))[1],
(get("shared/locale/countrycode"))[1]);
$admin="cn=admin,$dn";
} else {
input("medium", "slapd/custom_suffix");
go;
$dn=get("slapd/custom_suffix");
}
set("slapd/internal/dn", $dn);
set("slapd/internal/admin", $admin);
if (get("slapd/internal/adminpw") eq "") {
beginblock;
$ret=input("critical", "slapd/password1");
input("critical", "slapd/password2");
endblock;
go;
$pw1=get("slapd/password1");
$pw2=get("slapd/password2");
while ($ret!=30 and $pw1 ne $pw2) {
fset("slapd/password_mismatch", "seen", "false");
fset("slapd/password1", "seen", "false");
fset("slapd/password2", "seen", "false");
beginblock;
input("critical", "slapd/password_mismatch");
$ret=input("critical", "slapd/password1");
input("critical", "slapd/password2");
endblock;
go;
$pw1=get("slapd/password1");
$pw2=get("slapd/password2");
}
set("slapd/password1", "");
set("slapd/password2", "");
if ($pw1 eq "") {
$pw1=GenRandom(8);
fset("slapd/no_password", "seen", "false");
subst("slapd/no_password", "password", $pw1);
input("critical", "slapd/no_password");
go;
}
$pw1="{CRYPT}" . crypt($pw1, GenRandom(2));
set("slapd/internal/adminpw", $pw1);
}
}
########################################################################
# Configure replication via slurp
#
sub InitializeSlurp() {
local ($do);
input("medium", "slapd/replicate");
go;
$do=get("slapd/replicate");
return if ($do ne "true");
beginblock;
input("medium", "slapd/slurpd/host");
input("low", "slapd/slurpd/port");
input("medium", "slapd/slurpd/binddn");
input("medium", "slapd/slurpd/credentials");
endblock;
go;
}
########################################################################
# Main loop
if (-f $slapdconf) {
subst("slapd/conf_exists", "conf", $slapdconf);
input("low", "slapd/conf_exists");
go;
exit 0;
}
title("OpenLDAP configuration");
input("medium", "slapd/fill_method");
go;
$tst=get("slapd/fill_method");
if ($tst eq "auto") {
InitializeFromInput();
} else {
InitializeFromLdif();
}
InitializeSlurp();
stop;
/var/lib/dpkg/info/slapd.list/. /var /var/lib /var/lib/ldap /var/spool /var/spool/slurpd /etc /etc/ldap /etc/ldap/schema /etc/ldap/schema/corba.schema /etc/ldap/schema/core.schema /etc/ldap/schema/cosine.schema /etc/ldap/schema/inetorgperson.schema /etc/ldap/schema/java.schema /etc/ldap/schema/krb5-kdc.schema /etc/ldap/schema/misc.schema /etc/ldap/schema/nis.schema /etc/ldap/schema/openldap.schema /etc/init.d /etc/init.d/slapd /usr /usr/sbin /usr/sbin/slapd /usr/sbin/slapadd /usr/sbin/slapcat /usr/sbin/slapindex /usr/sbin/slappasswd /usr/sbin/slurpd /usr/share /usr/share/man /usr/share/man/man8 /usr/share/man/man8/slapcat.8.gz /usr/share/man/man8/slapindex.8.gz /usr/share/man/man8/slappasswd.8.gz /usr/share/man/man8/slurpd.8.gz /usr/share/man/man8/slapd.8.gz /usr/share/man/man8/slapadd.8.gz /usr/share/man/man5 /usr/share/man/man5/slapd.replog.5.gz /usr/share/man/man5/ldif.5.gz /usr/share/man/man5/slapd.conf.5.gz /usr/share/doc /usr/share/doc/slapd /usr/share/doc/slapd/slapd.conf /usr/share/doc/slapd/copyright /usr/share/doc/slapd/changelog.Debian.gz/var/lib/dpkg/info/slapd.postinst
#!/bin/sh
pkg=slapd
set -e
update_doclink() {
if [ -d /usr/doc -a ! -e /usr/doc/$pkg -a -d /usr/share/doc/$pkg ] ; then
ln -s ../share/doc/$pkg /usr/doc/$pkg
fi
}
if [ "$1" = "configure" -o "$1" = "abort-upgrade" ] ; then
update_doclink
fi
if [ -f /etc/ldap/slapd.conf -a \( "$1" != "configure" -o -n "$2" \) ] ; then
pf=$(sed -ne 's/^pidfile[[:space:]]\+\(.\+\)/\1/p' /etc/ldap/slapd.conf)
if [ -z "$pf" ] ; then
pf="/var/run/slapd.pid"
fi
start-stop-daemon --stop --quiet --oknodo --pidfile "$pf"
/etc/init.d/slapd start
exit 0
fi
# Load debconf
. /usr/share/debconf/confmodule
if [ -f /etc/ldap/slapd.conf ] ; then
if [ -z "$2" ] ; then
db_input slapd_conf_exists || true
db_go
fi
exit 0
fi
db_get slapd/internal/dn ; dn="$RET"
db_get slapd/internal/admin ; admin="$RET"
db_get slapd/fill_method ; method="$RET"
top=$(echo $dn | sed 's/,.*//')
key=$(echo $top | sed 's/=.*//')
value=$(echo $top | sed "s/$key=//")
if [ "$key" = "dc" ] ; then
class="dcObject"
elif [ "$key" = "ou" ] ; then
class="organizationalUnit"
elif [ "$key" = "c" ] ; then
class="country"
elif [ "$key" = "o" ] ; then
class="organization"
elif [ "$key" = "cn" ] ; then
class="organizationalRole"
else
db_input slapd/unknown_class || true
db_go
exit 1
fi
sed -e "s/@SUFFIX@/$dn/g" -e "s/@ADMIN@/$admin/" \
/usr/share/doc/slapd/slapd.conf > /etc/ldap/slapd.conf
chmod 644 /etc/ldap/slapd.conf
tmp=$(tempfile)
if [ "$method" = "ldif" ] ; then
db_get slapd/ldif_file ; ldif="$RET"
else
db_get slapd/internal/adminpw ; password="$RET"
ldif="$tmp"
cat <
/var/lib/dpkg/info/slapd.postrm
#!/bin/sh
set -e
purge_debconf() {
if [ -e /usr/share/debconf/confmodule ] ; then
. /usr/share/debconf/confmodule
db_purge
fi
}
purge_init() {
update-rc.d slapd remove >/dev/null
}
if [ "$1" = "purge" ] ; then
purge_init
purge_debconf "$@"
rm -f /etc/ldap/slapd.conf
rm -rf /var/lib/ldap
fi
exit 0
/var/lib/dpkg/info/slapd.prerm
#!/bin/sh
pkg=slapd
set -e
update_doclink() {
if [ -L /usr/doc/$pkg ] ; then
rm -f /usr/doc/$pkg
fi
}
stop_all() {
if [ -x /etc/init.d/slapd ] ; then
/etc/init.d/slapd stop
fi
}
stop_slurp() {
if grep -q '^replica' /etc/ldap/slapd.conf > /dev/null 2>&1 ; then
start-stop-daemon --stop --quiet --exec /usr/sbin/slurpd
fi
}
if [ "$1" = "remove" ] ; then
update_doclink
stop_all
elif [ "$1" = "upgrade" ] ; then
stop_slurp
fi
exit 0
/var/lib/dpkg/info/slapd.templates
Template: slapd/slurpd/host
Type: string
Description: LDAP server:
The fully qualified hostname of the remote LDAP server to replicate data
to.
Description-de: LDAP-Server:
Bitte den vollständigen Rechnernamen des anderen LDAP-Servers angeben, an
den die Änderungen weitergegeben werden sollen.
Template: slapd/internal/admin
Type: string
Description: Admin entry
The admin entry is the entry in the directory which has full read and
write access.
Description-de: Admin-Eintrag
Der Admin-Eintrag ist der Eintrag im Verzeichnis, der volle Lese- und
Schreibberechtigung hat.
Template: slapd/no_password
Type: note
Description: LDAP admin password
The slapd package generated a random password to the admin entry in your
new LDAP directory. The password is: ${password}.
Description-de: LDAP Admin-Passwort
Das slapd-Paket hat ein neues zufälliges Passwort für den Admin-Eintrag
Ihrer LDAP-Datenbank erzeugt. Das Passwort ist: ${password}.
Template: slapd/fill_method
Type: select
Choices: auto, ldif
Choices-de: automatisch, ldif-datei
Default: auto
Description: Directory initialization method:
The LDAP directory can be initialized either via an existing LDIF
datafile, or automatically using information you supply.
Description-de: Initialisierungsmethode für die Datenbank:
Das LDAP-Verzeichnis kann entweder mit einer bestehenden LDIF Datendatei,
oder automatisch mit von Ihnen eingegebenen Informationen gefüllt werden.
Template: slapd/internal/dn
Type: string
Description: Directory DN
Description-de: Verzeichnis-DN
Template: slapd/suffix_type
Type: select
Choices: domain or host, location, custom
Choices-de: Domain oder Host, Ort, Spezifisch
Default: domain or host
Description: Directory suffix style:
The LDAP directory suffix is the root of your LDAP database. You can
select one of three possible suffix styles:
.
Domain or host style uses the fully qualified hostname of your machine as
the basis.
.
Location uses country and organization name.
.
Custom allows you to speficy your own root root using whatever suffix you
want.
Description-de: Verzeichnis Suffix-Stil:
Das LDAP-Verzeichnis-Suffix ist die Wurzel ihrer LDAP-Datenbank. Sie
können einen der folgenden drei Stile dafür auswählen:
.
Der »Domain oder Host«-Stil verwendet den vollständigen Rechnernamen ihres
Computer als Basis. (dc=domain,dc=tld-Stil)
.
Der »Ort«-Stil verwendet das Land und den Organisationsnamen. (o=,c=)
.
Mit »Spezifisch« können sie als Wurzel ein selbstgewähltes Suffix angeben.
Template: slapd/ldif_noexist
Type: note
Description: ${ldif} does not exist
Please supply an exiting file in ldif format is needed to initialize the
directory.
Description-de: ${ldif} existiert nicht
Bitte geben Sie den Namen einer existierenden Datei im ldif-Format ein, um
das Verzeichnis zu initialisieren.
Template: slapd/slurpd/binddn
Type: string
Description: bind DN:
This is the DN used to bind to the remote LDAP server. It needs to have
full write access to the data being replicated.
Description-de: Verbindungs-DN
Dies ist die DN, die verwendet wird, um auf den anderen LDAP-Server
zuzugreifen. Sie braucht volle Schreibrechte um die Änderungen weitergeben
zu können.
Template: slapd/password_mismatch
Type: note
Description: passwords do not match
You need to enter the admin password twice. Please note that differences
such as uppercase/lowercase and added whitespace matter.
Description-de: Passwörter stimmen nicht überein
Sie müssen das Admin-Passwort zweimal gleich eingeben. Bitte beachten Sie
dass es einen Unterschied macht, ob sie Grossbuchstaben oder Leerzeichen
verwenden.
Template: slapd/domain
Type: string
Description: Enter the domain name
Description-de: Geben Sie den Domainnamen ein
Template: slapd/replicate
Type: boolean
Default: false
Description: Replicate to another LDAP server:
It is possible to replicate changes made in this LDAP server to another
server.
Description-de: Auf anderen LDAP-Server weitergeben:
Es ist möglich, an diesem LDAP-Server vorgenommene Änderungen an einen
anderen Server weiterzugeben.
Template: slapd/internal/adminpw
Type: password
Description: encrypted admin password
Description-de: verlüsselte Admin-Passwort
Template: slapd/password1
Type: password
Description: Admin password:
Please enter the password for the admin entry in your LDAP directory.
Description-de: Admin-Passwort:
Bitte geben Sie das Passwort für den Admin-Eintrag ihres
LDAP-Verzeichnisses ein.
Template: slapd/custom_suffix
Type: string
Description: Enter your suffix:
Please enter the desired directory suffix for your directory using
standard LDAP DN syntax.
Description-de: Geben Sie ihr Suffix ein:
Bitte geben Sie das gewünschte Suffix für ihr Verzeichnis in der Standard
LDAP DN-Syntax ein.
Template: slapd/password2
Type: password
Description: Verify password:
Description-de: Passwort wiederholen:
Template: slapd/slurpd/credentials
Type: password
Description: Password:
This the password used to bind to the remote LDAP server.
Description-de: Passwort:
Das Passwort, um auf den anderen LDAP-Server zuzugreifen.
Template: slapd/unknown_class
Type: note
Description: Unknown object class used
The root DN for your directory uses an unknown object class so the
directory can not be initialized. Valid object classes are:
.
dcObject (dc)
organizationalUnit (ou)
country (c)
organization (o)
Description-de: Unbekannte Objektklasse verwendet
Der Wurzel-DN für ihr Verzeichnis verwendet eine unbekannte Objektklasse,
daher kann das Verzeichnis nicht initialisiert werden. Gültige
Objektklassen sind:
.
dcObject (dc)
organizationalUnit (ou)
country (c)
organization (o)
Template: shared/locale/countrycode
Type: string
Description: Enter your country's two digit code:
Description-de: Bitte geben Sie ihren Zwei-Zeichen Ländercode ein:
Template: slapd/conf_exists
Type: note
Description: slapd is already configured
You can use this configure system only once for the slapd daemon. Please
either manually change the configuration in ${conf} or remove both it and
your databases and rerun this configuration.
Description-de: slapd bereits konfiguriert
Sie können dieses Konfigurationssystem nur einmal für den slapd-Daemon
verwenden. Bitte ändern Sie entweder von Hand die Konfiguration in ${conf}
oder entfernen Sie sowohl diese Datei als auch Ihre Datenbanken und
starten Sie diese Konfiguration erneut.
Template: slapd/ldif_file
Type: string
Description: Path to ldif file:
You need to give the full path of the file containing the ldif formatted
entries to be entered into the database.
Description-de: Pfad zur ldif-Datei:
Bitte geben Sie den vollständigen Pfad der Datei ein, welche die im
ldif-Format gehaltenen Einträge enthält, die in die Datenbank sollen.
Template: shared/organization
Type: string
Description: Enter the name of your organization:
Description-de: Geben Sie den Namen ihrer Organisation ein:
Template: slapd/slurpd/port
Type: string
Default: 389
Description: Port on remote server:
The port on which the LDAP server runs on the remote server. This is
almost always the default LDAP port (389).
Description-de: Port des anderen Servers:
Der Port, auf dem am anderen Server der LDAP-Dienst läuft. Dies ist fast
immer der Standard-LDAP-Port (389).
|