ldap - ein kleiner einführungsworkshop · ldap - ein kleiner einführungsworkshop...
TRANSCRIPT
LDAP - ein kleinerEinführungsworkshopLinux-Infotag Augsburg 2017 22. April 2017
Michael WandelLinux Consultant & Trainer
B1 Systems [email protected]
Vorstellung B1 Systemsgegründet 2004primär Linux/Open Source-Themennational & international tätigca. 100 Mitarbeiterunabhängig von Soft- und Hardware-HerstellernLeistungsangebot:
Beratung & ConsultingSupportEntwicklungTrainingBetriebLösungen
Büros in Rockolding, Köln, Berlin & Dresden
B1 Systems GmbH LDAP - ein kleiner Einführungsworkshop 2/41
Agenda Workshop
WillkommenLDAP-GrundlagenBeispiel LDAP BaumLinux SystemanbindungApplikationsanbindungErweiterungen
B1 Systems GmbH LDAP - ein kleiner Einführungsworkshop 4/41
LDAP Grundlagen
LDAP als ProkollBegriffe im LDAPversumLDAP - ObjekteBeispiele für Objektklassen und AttributeLDIF zum DatenaustauschLDAP Implementierungen
B1 Systems GmbH LDAP - ein kleiner Einführungsworkshop 5/41
Beispiel LDAP Baum
InstallationKonfigurationWerkzeugen im LDAP UmfeldSchema und ErweiterungenSSL / TLS Einrichtung
B1 Systems GmbH LDAP - ein kleiner Einführungsworkshop 6/41
LDAP Elemente
Beispiel einer LDAP StrukturLDAP Objekte und AttributeLDAP Schema für Posix User/GruppenLDAP GruppenLDAP Schemaerweiterungen für Applikationen
B1 Systems GmbH LDAP - ein kleiner Einführungsworkshop 7/41
Nutzung des LDAP Baumes
LDAP Baum nutzenSystemanbindung mittels SSSDApache AnbindungPostfix Anbindung
Postmap InformationenSASL Authentikation
Adressbuch
B1 Systems GmbH LDAP - ein kleiner Einführungsworkshop 8/41
Agenda Part 5
LDAP Erweiterungen / Overlayssyncprovauditloguniquememberofrefintaccesslogppolicy. . .
B1 Systems GmbH LDAP - ein kleiner Einführungsworkshop 9/41
LDAP als Protokoll
1993 LDAP Definition RFC 1487LDAP v3 Erweiterung RFC 2251aktuelles LDAP Hauptdokument RFC 4510über 90 RFCs, teilweise auch Ersetzungen
siehe auch:https://www.ldap.com/ldap-specifications-defined-in-rfcs
B1 Systems GmbH LDAP - ein kleiner Einführungsworkshop 10/41
Protokoll Elemente
BindSearchCompareAddDeleteModifyModifyDNUnbind
AbandonExtendedStartTLS
B1 Systems GmbH LDAP - ein kleiner Einführungsworkshop 11/41
Begriffe im LDAPversum
B1 Systems GmbH LDAP - ein kleiner Einführungsworkshop 12/41
LDAP Objekte
hierarchische StrukturRoot-Objekt (Base,Suffix)jedes Objekt besitzt eindeutigen DNstrukturelle Objektklassen (structural)Erweiterungen durch Hilfsklassen (auxiliary)Attribute (Must oder May)LDIF Format für LDAP Import/Export
B1 Systems GmbH LDAP - ein kleiner Einführungsworkshop 13/41
Beispiele:Objektklassen und AttributeObjektklassen
organizationorganizationalUnitpersonorganizationalPersoninetorgPersonaccountgroupOfNamesgroupOfuniqueNamesposixAccountposixGroup
Attributecn, commonNameo, organizationNameou, organizationalUnitNamesn, surNamegn, givenNamedescriptionl, localityNameuid, useriduserPasswordjpegPhoto
B1 Systems GmbH LDAP - ein kleiner Einführungsworkshop 14/41
Schemabeispiel :Objektklassen und Attribute
Definition Objektklasse: account
objectclass ( 0.9.2342.19200300.100.4.5 NAME ’account’SUP top STRUCTURALMUST useridMAY ( description $ seeAlso $ localityName $
organizationName $ organizationalUnitName $ host ))
Definition Attribut: host
attributetype ( 0.9.2342.19200300.100.1.9 NAME ’host’DESC ’RFC1274: host computer’EQUALITY caseIgnoreMatchSUBSTR caseIgnoreSubstringsMatchSYNTAX 1.3.6.1.4.1.1466.115.121.1.15{256} )
B1 Systems GmbH LDAP - ein kleiner Einführungsworkshop 15/41
Beispiel für LDIF LDAP Objekt
Basis Objekt im LDIF-Formatdn: dc=example,dc=comobjectclass: topobjectclass: organizationobjectclass: dcobjectdc: exampleo: LDAP Workshop
B1 Systems GmbH LDAP - ein kleiner Einführungsworkshop 16/41
LDAP Implenentierungen
OpenLDAP389 Directory ServerMicrosoft Active DirectorySamba 4 mit AD UnterstützungOracle Internet DirectoryApache Directory Server / OpenDJTivoli Directory Serverldapjs. . .
B1 Systems GmbH LDAP - ein kleiner Einführungsworkshop 17/41
Beispiel LDAP Baum
InstallationKonfiguration slapd.conf versus slapd.dBackup und RestoreWerkzeuge im LDAP-UmfeldSchemaerweiterungenSSL/TLS-EinrichtungPraktische Übungen
B1 Systems GmbH LDAP - ein kleiner Einführungsworkshop 18/41
Installation LDAP Server und Client
LDAP Serveryum install openldap-servers
LDAP Clientsyum install openldap-clients
alternative Repo Quelle: https://ltb-project.org/
B1 Systems GmbH LDAP - ein kleiner Einführungsworkshop 19/41
Konfigurationsumfeld
OpenLDAP ServerKonfigurationsverzeichnis/etc/openldapd/slapd.dKonfigurationsdatei (veraltet)/etc/openldap/slapd.conf
OpenLDAP ClientsKonfigurationsdatei LDAP Client/etc/openldap/ldap.conf
B1 Systems GmbH LDAP - ein kleiner Einführungsworkshop 20/41
Backup, Restore & more
Backupslapcat -b dc=example,dc=com > ldap-$(date +%F-%T).ldif
slapcat -b cn=config > ldap-config-$(date +%F-%T).ldif
Backup kann auch im laufenden Betrieb gemacht werden
Restoreservice slapd stoprm -rf /var/lib/ldap/*slapadd < ldap.ldifchown -R ldap:ldap /var/lib/ldapservice slapd start
Restore bei gestopptem Service
B1 Systems GmbH LDAP - ein kleiner Einführungsworkshop 21/41
Beispiel LDAP Baum
Dateiverzeichnis slapd.dcn=config
cn=schemacn={0}core.ldif
cn=schema.ldifolcDatabase={0}config.ldifolcDatabase={-1}frontend.ldifolcDatabase={1}monitor.ldifolcDatabase={2}hdb.ldif
cn=config.ldif
B1 Systems GmbH LDAP - ein kleiner Einführungsworkshop 22/41
LDAP slap-Tools serverseitig
slapaddslapcatslappasswdslapaclslapindexslaptest. . .
Passwordhash erzeugenslappasswd -h {SSHA} -s geheim
B1 Systems GmbH LDAP - ein kleiner Einführungsworkshop 23/41
LDAP Client Toolsldapaddldapsearchldapdeleteldapmodifyldapmodrdnldapwhoamildapurl. . .
LDAP Objekt löschenldapdelete -x -W -D cn=admin,dc=example,dc=com \
uid=heinz,ou=users,dc=example,dc=com
Das Beispiel setzt eine konfigurierte /etc/openldap/ldap.confvoraus.
B1 Systems GmbH LDAP - ein kleiner Einführungsworkshop 24/41
Schemaerweiterungen
LDAP Standardschema -> coreSchemaerweiterungen
cosineinetorgpersonnis (alternativ rfc2307bis)ppolicydyngroup. . .
Schema hinzufügenldapadd -Y EXTERNAL -H ldapi:/// \
-f /etc/openldap/schema/cosine.schema
B1 Systems GmbH LDAP - ein kleiner Einführungsworkshop 25/41
Praktische Beispiele
Übungen zur Online-KonfigurationOnline Konfiguration cn=config
Erstellen eines BasisobjektesSchema und ModuleerweiterungenHinzufügen von ersten Objekten mittels LDIF DateienSuchen im LDAP BaumPasswortänderung eines Benutzers
B1 Systems GmbH LDAP - ein kleiner Einführungsworkshop 26/41
Browser und Editoren
Überblick aktulle Browser und Editorenldapvi (*)shelldapApache Directory Studio (*)jxplorerphpldapadminLDAP Account Manager (lam)FusionDirectory
B1 Systems GmbH LDAP - ein kleiner Einführungsworkshop 27/41
Praktische Übungen
Freie Workshop ÜbungenInstallation und Übungen mit ldapviEinrichtung Apache Direchtory Studio
B1 Systems GmbH LDAP - ein kleiner Einführungsworkshop 28/41
Aktivierung LDAPS Protokoll
SSL, da Passwörter im Klartext übertragen werdenalternativ START_TLS über ldap://Defaultzertifikate im moznss Format unter/etc/openldap/certs
Datei: /etc/sysconfig/slapd
ldaps:// Protokoll-Aktivierung...SLAPD_URLS=‘‘ldapi:/// ldap:/// ldaps:///’’...
B1 Systems GmbH LDAP - ein kleiner Einführungsworkshop 29/41
LDAP für Posix Logins nutzen
LDAP Posix Objekte/AttributeNSS, Identität im LinuxsystemPAM, Authentifikation und Authorisierungverschiedene LDAP Clients
B1 Systems GmbH LDAP - ein kleiner Einführungsworkshop 30/41
LDAP für Posix Logins nutzen
Beispiele Objekklassen Schema NIS:User posixaccount, shadowaccount
Group posixgroupHosts ipHost
Services ipService
B1 Systems GmbH LDAP - ein kleiner Einführungsworkshop 31/41
Beispiel LDIF Posix Useruid=heinzdn: uid=heinz,ou=users,dc=example,dc=comobjectclass: topobjectclass: personobjectclass: organizationalPersonobjectclass: inetorgPersonobjectclass: posixAccountobjectclass: shadowAccountcn: Heinz Ketchupgn: Heinzsn: Ketchupuid: heinzuidnumber:6001gidnumber:5001homedirectory: /home/heinzuserPassword: ketchup
B1 Systems GmbH LDAP - ein kleiner Einführungsworkshop 32/41
Beispiel LDIF Posix Group
cn=ldapuserdn: cn=ldapuser,ou=groups,dc=example,dc=comobjectclass: topobjectclass: posixgroupcn: ldapusergidnumber: 5001memberuid: heinz
B1 Systems GmbH LDAP - ein kleiner Einführungsworkshop 33/41
Beispiel LDIF LDAP Gruppe
cn=ldapuserdn: cn=webuser,ou=groups,dc=example,dc=comobjectclass: topobjectclass: groupOfNamesmember: uid=elke,ou=users,dc=example,dc=com
B1 Systems GmbH LDAP - ein kleiner Einführungsworkshop 34/41
Linux SSSD Anbindung
Warum SSSD ?SSSD unterschiedlichste Anbindungldap, kerberos, ipa, ad, . . .Caching und CachekontrolleMulti DomänenDebuggingHohe Flexibilität. . .
B1 Systems GmbH LDAP - ein kleiner Einführungsworkshop 35/41
Installation und Konfiguration sssd-ldap 1/2
Installation sssd-ldapyum install sssd-ldap
Konfiguration mit authconfigauthconfig --enablesssd --enablesssdauth \
--ldapserver=ldap1.example.com \--enableldaptls \--enablemkhomedir \--update
B1 Systems GmbH LDAP - ein kleiner Einführungsworkshop 36/41
Installation und Konfiguration sssd-ldap 2/2
Beispiel sssd.conf[sssd]domains = LDAPservices = nss, pamconfig_file_version = 2[nss][pam][domain/LDAP]cache_credentials = trueid_provider = ldapauth_provider = ldapldap_uri = ldap://ldap1.example.comldap_search_base = dc=example,dc=comldap_id\_use_start_tls = trueldap_tls_reqcert = allow
B1 Systems GmbH LDAP - ein kleiner Einführungsworkshop 37/41
Grundlagen Applikationsanbindung
LDAP Applikations InformationenLDAP URL oder HostnameBaseDNBindDNBindPWFilterevtl. Attribute Mapping
native LDAP AnbindungAnbindund per SASLAnbidung per PAM
B1 Systems GmbH LDAP - ein kleiner Einführungsworkshop 38/41
Beispiel Apache Anbidung
Module seit 2.2 im CoreAuthentikation und AuthorizationEigener LDAP CacheViele Authorisierungsmöglichkeiten(Filter, Gruppen, einzelne User)
Installation LDAP Modulyum install mod_ldap
B1 Systems GmbH LDAP - ein kleiner Einführungsworkshop 39/41
Beispiel Apache Anbidung II
Beispiel .htaccessAuthType BasicAuthName "LOGIN"AuthBasicProvider ldapAuthzLDAPAuthoritative onAuthLDAPURL
"ldap://ldap1.example.com/dc=example,dc=com?uid?sub?(objectClass=*)"AuthLDAPBindDN "cn=admin,dc=example,dc=com"AuthLDAPBindPassword geheimrequire valid-user
B1 Systems GmbH LDAP - ein kleiner Einführungsworkshop 40/41
Vielen Dank für Ihre Aufmerksamkeit!Bei weiteren Fragen wenden Sie sich bitte an [email protected]
oder +49 (0)8457 - 931096