PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : OpenLDAP einrichten/konfigurieren



Cabron
24.11.05, 09:43
Hallo,

sorry, für diese ollen Newbie Fragen. Meine Linuxkenntnisse sind noch am Anfang und LDAP kenne ich auch noch nicht lange, aber ich arbeite daran, versporchen :rolleyes:

Jedenfalls komme ich beim Konfigurieren eines installierten OpenLDAP Serves nicht weiter. Das verwendete System ist in diesem Fall Fedora Core 2.

Das "HowTo" http://www.openldap.org/doc/admin23/slapdconf2.html des Anbieters kapier ich nicht so recht. Ich verstehe die Zusammenhänge noch nicht ganz.

Auch dieses HowTo http://www.linuxhaven.de/dlhp/HOWTO/DE-LDAP-HOWTO-6.html#DE-LDAP-HOWTO-beispielverzeichnis funktioniert nicht wirklich bei mir, davon abgesehen habe ich das Programm "ldif2ldbm" nicht.

Dazu gibt es aber das Programm "ldapadd", ja? Dieses wandelt die .ldif Files in Datenbankeinträge um? Kann mir mal jemand die Snytax von ldapadd erläutern?


Die Datenbankeinträge schreibe ich in eine .ldif File hinein, ja?
Also zum Beispiel wie auf der zweiten verlinkten Seite als Beispiel gegeben:



dn: dc=structure-net, dc=de
objectclass: organization
objectclass: top
o: Structure Net
l: Hamburg
postalcode: 21033
streetadress: Billwiese 22

dn: ou=Sales, dc=structure-net, dc=de
objectclass: organizationalunit
ou: Sales
description: Verkauf
telephonenumber: 040-7654321
facsmiletelephonenumber: 040-7654321

dn: ou=Development, dc=structure-net, dc=de
objectclass: organizationalunit
ou: Development
description: Verkauf
telephonenumber: 040-7654321
facsmiletelephonenumber: 040-7654321

dn: ou=Support, dc=structure-net, dc=de
objectclass: organizationalunit
ou: Support
description: Verkauf
telephonenumber: 040-7654321
facsmiletelephonenumber: 040-7654321

dn: uid=admin, dc=structure-net, dc=de
objectclass: person
objectclass: organizationalperson
objectclass: inetorgperson
cn: admin
cn: Systemverwalter
cn: Thomas Bendler
sn: Bendler
uid: admin
mail: tbendler@structure-net.de
l: Hamburg
postalcode: 21033
streetadress: billwiese 22
telephonenumber: 040-7654321
facsmiletelephonenumber: 040-7654321


So und was muss ich nun in ldap.conf und slapd.conf ändern, um dieses Beispiel zum laufen zu bringen?

Als "Browser", um mir das Ergebnis dann ansehen zu können (wenn es endlich klappt), verwende ich Ldapadmin.

Für Hilfe wäre ich sehr sehr sehr dankbar! :)

Polarizer
24.11.05, 10:14
Nun ja, Du beiden Quellen die Du da hast, sind's nicht wirklich. Schau Dir das Ganze mal unter Linuxbu.ch an. Dort unter 3.5 wird's erklärt.

[1] http://www.linuxbu.ch/pdf5/kapitel03.pdf

Cabron
24.11.05, 16:54
Danke für die Quelle!!!!!!!!! :) Die ist wirklich besser, nun verstehe ich auch schon viel mehr die Zusammenhänge. Schade aber, dass dort sich von der Konsolen abgewandt wird. Aber das ist nun nicht das Problem.

Nun habe ich das nach dieser Quelle gemacht, aber den typischen Fehler:


ldapadd -x -D "cn=Manager,dc=mydomain,dc=de" -W -f init.ldif
Enter LDAP Password:
ldap_bind: Invalid credentials

Hier die tolle slapd.conf:


#
# See slapd.conf(5) for details on configuration options.
# This file should NOT be world readable.
#
include /usr/local/etc/openldap/schema/core.schema
# include /usr/local/etc/openldap/schema/nis.schema
schemacheck on

# Define global ACLs to disable default read access.

# Do not enable referrals until AFTER you have a working directory
# service AND an understanding of referrals.
#referral ldap://root.openldap.org

pidfile /usr/local/var/run/slapd.pid
argsfile /usr/local/var/run/slapd.args

# Load dynamic backend modules:
# modulepath /usr/local/libexec/openldap
# moduleload back_bdb.la
# moduleload back_ldap.la
# moduleload back_ldbm.la
# moduleload back_passwd.la
# moduleload back_shell.la

# 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
# Directives needed to implement policy:
# access to dn.base="" by * read
# access to dn.base="cn=Subschema" by * read
# 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. (e.g., "access to * by * read")
#
# rootdn can always read and write EVERYTHING!

################################################## #####################
# BDB database definitions
################################################## #####################

database bdb
checkpoint 1024 5
cachesize 10000
suffix "dc=mydomain,dc=site"
rootdn "cn=Manager,dc=mydomain,dc=site"
# Cleartext passwords, especially for the rootdn, should
# be avoid. See slappasswd(8) and slapd.conf(5) for details.
# Use of strong authentication encouraged.
rootpw geheim
# password-hash {CLEARTEXT}
# The database directory MUST exist prior to running slapd AND
# should only be accessible by the slapd and slap tools.
# Mode 700 recommended.
directory /usr/local/var/openldap-data
# Indices to maintain
index cn,sn,uid pres,eq,approx,sub
index objectClass pres,eq
# index default none
defaultaccess read
acess to attr=userpassword
by self write
by dn="uid=admin,dc=structure-net,dc=de" write
by * compare


Das Passwort ist "geheim", daran liegt es nicht.

Naja, schade, irgendwas ist ja immer :o :( Die Suchfunktion habe ich genutzt, aber irgendwie helfen mir die bisherigen threads dazu gar nicht weiter.

Muss ich vielleicht in der ldap.conf (nicht slapd.conf) etwas anpassen?

Da steht quasi nur drin:


#BASE base=dc=linux, dc=home
#URI ldap://ldap.example.com ldap://ldap-master.example.com:666

#SIZELIMIT 12
#TIMELIMIT 15
#DEREF never

, aber ja auskommentiert, also nix.

Kein Wunder, das LDAP niemand haben will (Scherz) ;)

Polarizer
25.11.05, 09:33
Die slapd.conf ist für den Server. Die ldad.conf für den Client. Da auf einem Rechner nicht zwingend ein LDAP-Server laufen muß, Services auf diesem Rechner aber LDAP verwenden, muß der Client separat konfiguriert werden.

Die Angaben für den Client (Server,DN für Abfragen, Passwort, Certificat ect)
werden üblicherweise in /etc/ldap.conf (ja, davon gibt es zwei) hinterlegt. Diese credentials (Zugangsdaten/information) werden dann von slapcat/slapadd ect. benutzt.

Um zu sehen was daneben geht, setze einfach den Loglevel hoch


man sldap.conf

loglevel <integer>
Specify the level at which debugging statements and operation statistics should be syslogged (currently
logged to the syslogd(8) LOG_LOCAL4 facility). Log levels are additive, and available levels are:
1 trace function calls
2 debug packet handling
4 heavy trace debugging
8 connection management
16 print out packets sent and received
32 search filter processing
64 configuration file processing
128 access control list processing
256 stats log connections/operations/results
512 stats log entries sent
1024 print communication with shell backends
2048 entry parsing


Hope that helps.

heatwalker
25.11.05, 10:03
Erweitere deine ldap.conf mal um

host localhost
base dc=structure-net, dc=de
Alternativ den hostnamen in base hinzufügen

base dc=host, dc=structure-net, dc=de
Alle Dateien im Ordner "/var/lib/ldap/" löschen.
Den ldapserver starten und dein ldap.file einspielen.

Cabron
25.11.05, 12:27
Tausend Dank @Polarizer und Heatwalker für eure Antworten!

Allerdings war es ganz allein ein Problem meiner Unwissenheit.

Es gibt zwei slapd.conf, nämlich einmal in /usr/local/etc/openldap/ und einmal in /etc/openldap/
Das letztere ist das Verzeichnis mit der wirksamen slapd.conf. Nun habe ich diese so abgeändert, wie ich gepostet habe und es funktioniert!

Hatte also mit meiner Blödheit zu tun, sorry. Aber es gibt noch mehr slpad.conf Dateien, diese beachte ich gar nicht weiter, es funktioniert ja jetzt, bloß woher kommen die alle? hm..

Dieses Hinderniss ist überwunden!

Ich halte mich wie gesagt an das Beispiel, aus dem Linuxbu.ch.

Wenn ich nun diese....


dn: dc=mydomain, dc=site
objectClass: dcObject
objectClass: top
objectClass: namedObject
dc: mydomain

...LDIF Datei hinzufügen will,
kommt das hier:


ldapadd -x -D "cn=Manager,dc=mydomain,dc=site" -w geheim -f init.ldif
adding new entry "dc=mydomain, dc=site"
ldap_add: Invalid syntax (21)
additional info: objectClass: value #2 invalid per syntax


Natürlich habe ich wieder die Suchfunktion genutzt. Viele hatten dieses Problem, wenn in der LDIF Datei Zeilen oder Leerzeichen zu viel waren, allerdings ist das in meiner init.ldif nicht der Falle (mehr mals komtrolliert).

Naja, ihr habt mir bis hier hin schon mal viel geholfen, vielen Dank! :)

Polarizer
25.11.05, 13:31
Also ich füge meine ldif-Dateien immer mit
slapadd -v -l datei.ldif hinzu. Dabei werden die Fehler besser angezeigt.

Das Leerzeichen vor dc=site? Sonst fehlt auch noch:

o: irgendwas

Cabron
28.11.05, 08:54
Also ich füge meine ldif-Dateien immer mit
slapadd -v -l datei.ldif hinzu. Dabei werden die Fehler besser angezeigt.

Das Leerzeichen vor dc=site? Sonst fehlt auch noch:

o: irgendwas

Wenn ich das mache, kommt "slapadd: Bad configuartion file!".:ugly:

Sagt dir das vielleicht etwas?

Cabron
29.11.05, 10:48
Hm, naja irgendwann will ich das doch mal fertig haben, deswegen versuche ich es hier weiter.

Dieses Problem mit "value #2 invalid per syntax" besteht leider immer noch.

Das Leerzeichen vor "dc=site" macht nix, habe es aber auch mal weggemacht.
o: irgendwas habe ich auch probiert, passiert nix.
slapadd -v -l datei.ldif funzt nicht (bad configuration file!)

Es ist zum Heulen.



dn: dc=mydomain,dc=site
objectclass: organization
objectclass: top
o: Structure Net
1: Hamburg
postalcode: 21033
streetadress: Billwiese 22

dn: ou=Sales,dc=mydomain,dc=site
objectclass: organizationalunit
ou: Sales
description: Verkauf
telephonnumber: 040-7654321
facsmiletelephonnumber: 040-7654321

dn: ou=Development,dc=mydomain,dc=site
objectclass: organizationalunit
ou: Development
description: Verkauf
telephonnumber: 040-7654321
facsmiletelephonnumber: 040-7654321

dn: ou=Support,dc=mydomain,dc=site
objectclass: organizationalunit
ou:Support
description: Verkauf
telephonnumber: 040-7654321
facsmiletelephonnumber: 040-7654321

dn: uid=Manager,dc=mydomain,dc=site
objectclass: person
objectclass: organizationalperson
objectclass: inetorgperson
cn: admin
cn: Systemverwalter
cn: Thomas Bendler
sn: Bendler
uid: admin
mail: dingens@dingens.di
1: Hamburg
postalcode: 21682
streetadress: billwiese 22
telephonnumber: 040-4444444
facsmiletelephonnumber: 040-7654321


Jetzt habe ich diese LDIF File hergerichtet (natürlich ohne Leerzeichen am Ende).


ldapadd -x -D "cn=Manager,dc=mydomain,dc=site" -w geheim -f /usr/local/etc/openldap/ldif/teststructur.ldif
adding new entry "dc=mydomain,dc=site"
ldap_add: Undefined attribute type (17)
additional info: 1: attribute type undefined

Woran liegt das nun wieder? Naja, wenn ich dann bald mal alle Fehlermöglichkeiten durchgekaut habe, dann werde ich vielleicht mal selber nen LDAP Profi :D Aber bis dahin ist der Weg wohl sehr sehr steinig.
Bitte helft mir :o



#
# See slapd.conf(5) for details on configuration options.
# This file should NOT be world readable.
#
include /etc/openldap/schema/core.schema
# include /etc/openldap/schema/nis.schema
schemacheck on

# Allow LDAPv2 client connections. This is NOT the default.
allow bind_v2

# Do not enable referrals until AFTER you have a working directory
# service AND an understanding of referrals.
#referral ldap://root.openldap.org

pidfile /var/run/slapd.pid
argsfile /var/run/slapd.args

# Load dynamic backend modules:
# modulepath /usr/sbin/openldap
# moduleload back_bdb.la
# moduleload back_ldap.la
# moduleload back_ldbm.la
# moduleload back_passwd.la
# moduleload back_shell.la

# The next three lines allow use of TLS for encrypting connections using a
# dummy test certificate which you can generate by changing to
# /usr/share/ssl/certs, running "make slapd.pem", and fixing permissions on
# slapd.pem so that the ldap user or group can read it. Your client software
# may balk at self-signed certificates, however.
# TLSCACertificateFile /usr/share/ssl/certs/ca-bundle.crt
# TLSCertificateFile /usr/share/ssl/certs/slapd.pem
# TLSCertificateKeyFile /usr/share/ssl/certs/slapd.pem

# 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
# Directives needed to implement policy:
# access to dn.base="" by * read
# access to dn.base="cn=Subschema" by * read
# 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. (e.g., "access to * by * read")
#
# rootdn can always read and write EVERYTHING!

################################################## #####################
# ldbm and/or bdb database definitions
################################################## #####################

database bdb
checkpoint 1024 5
cachesize 10000
suffix "dc=mydomain,dc=site"
rootdn "cn=Manager,dc=mydomain,dc=site"
# Cleartext passwords, especially for the rootdn, should
# be avoided. See slappasswd(8) and slapd.conf(5) for details.
# Use of strong authentication encouraged.
rootpw geheim
# rootpw {crypt}ijFYNcSNctBYg

# The database directory MUST exist prior to running slapd AND
# should only be accessible by the slapd and slap tools.
# Mode 700 recommended.
directory /var/lib/ldap
# Indices to maintain for this database

# Replicas of this database
#replogfile /var/lib/ldap/openldap-master-replog
#replica host=ldap-1.example.com:389 starttls=critical
# bindmethod=sasl saslmech=GSSAPI
# authcId=host/ldap-master.example.com@EXAMPLE.COM

vitoek
23.03.07, 14:37
hi all, dieses Thema, so hoffte ich, bringt mich weiter. Die Linuxbu.ch Version der Howtos ist echt besser, aber selbst damit scheiterts bei mir.
Ich benutze Ubuntu Edgy, installiert ist slapd, libldap, ldap-utils, db4.2.xx

ich habe eine slapd.conf in:

/etc/ldap
und

/usr/local/etc/openldap/

die erstere bewirkt nichts, die Modifizierung der zweiten brachte:

mymachine# slaptest
/etc/ldap/schema/core.schema: line 128: Duplicate attributeType: "2.5.4.13"
slaptest: bad configuration file!

zudem hab ich kein rcldap Runlevelskript, wie im Buch beschrieben

egal ob ich
slapd startoder
slapd stop mache kommt beim ldapsearch -x folgendes raus:

ldapsearch
# extended LDIF
#
# LDAPv3
# base <> with scope subtree
# filter: (objectclass=*)
# requesting: ALL
#

# search result
search: 2
result: 32 No such object

# numResponses: 1


folgendes kommt beim erweiterten ldapsearch nach Anleitung raus:

ldapsearch -x -D "cn=Manager,dc=apollon,dc=upb.de" -W
Enter LDAP Password:
ldap_bind: Invalid credentials (49)

Ich versuche mich schon seit 3 Tagen dran, und bin am verzweifeln.
Habe so gehofft, dass das Linuxbu.ch mich nun weiterbringt, aber es klappt einfach nicht :(