Openldap-linux-pam-nss: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
| Zeile 27: | Zeile 27: | ||
[[Datei:Ldap-66.png]] | [[Datei:Ldap-66.png]] | ||
=Konfiguration des Clients= | =Konfiguration des Clients= | ||
| − | =ldap.conf= | + | ==ldap.conf== |
*cat /etc/ldap/ldap.conf | *cat /etc/ldap/ldap.conf | ||
base dc=it21, dc=int | base dc=it21, dc=int | ||
| Zeile 34: | Zeile 34: | ||
rootbinddn cn=admin, dc=it21, dc=int | rootbinddn cn=admin, dc=it21, dc=int | ||
pam_password md5 | pam_password md5 | ||
| − | =Passwort für den Adminzugang eintragen= | + | ==Passwort für den Adminzugang eintragen== |
*echo 123Start$ > /etc/ldap.secret | *echo 123Start$ > /etc/ldap.secret | ||
| + | =Kontrolle= | ||
| + | ==Stimmt der base dn?= | ||
| + | *ldapsearch -x -LLL | ||
| + | dn: dc=it21,dc=int | ||
| + | objectClass: top | ||
| + | objectClass: dcObject | ||
| + | objectClass: organization | ||
| + | o: int21 | ||
| + | dc: it21 | ||
| + | =Grundstruktur= | ||
| + | ==Erstellen== | ||
| + | *cat /root/struktur.ldif | ||
| + | <pre> | ||
| + | dn: ou=users,dc=it21,dc=int | ||
| + | objectClass: organizationalUnit | ||
| + | ou: users | ||
| + | dn: ou=groups,dc=it21,dc=int | ||
| + | objectClass: organizationalUnit | ||
| + | ou: groups | ||
| + | |||
| + | dn: ou=hosts,dc=it21,dc=int | ||
| + | objectClass: organizationalUnit | ||
| + | ou: hosts | ||
| + | |||
| + | dn: cn=it,ou=groups,dc=it21,dc=int | ||
| + | objectClass: posixGroup | ||
| + | cn: it | ||
| + | gidNumber: 3001 | ||
| + | </pre> | ||
| + | ==Anlegen== | ||
| + | ldapadd -xD cn=admin,dc=it21,dc=int -w 123Start$ -f struktur.ldif | ||
| + | adding new entry "ou=users,dc=it21,dc=int" | ||
| + | |||
| + | adding new entry "ou=groups,dc=it21,dc=int" | ||
| + | |||
| + | adding new entry "ou=hosts,dc=it21,dc=int" | ||
| + | |||
| + | adding new entry "cn=it,ou=groups,dc=it21,dc=int" | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
==Starten des slapd== | ==Starten des slapd== | ||
| Zeile 75: | Zeile 107: | ||
=Defaultclientkonfiguration von LDAP= | =Defaultclientkonfiguration von LDAP= | ||
*[[ldap.conf]] | *[[ldap.conf]] | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
=gruppe hinzufügen= | =gruppe hinzufügen= | ||
Version vom 15. September 2022, 16:04 Uhr
installation
- passwort nach wahl festlegen
- apt install slapd ldap-utils libldap2-dev
- slapd
- OpenLDAP Standalone Server
- ldap-utils
- Utilities zum Zugriff auf den LDAP Server
Grundkonfiguration
Weitere Konfiguration
- dpkg-reconfigure -p low slapd
Konfiguration des Clients
ldap.conf
- cat /etc/ldap/ldap.conf
base dc=it21, dc=int uri ldap://server.it21.int ldap_version 3 rootbinddn cn=admin, dc=it21, dc=int pam_password md5
Passwort für den Adminzugang eintragen
- echo 123Start$ > /etc/ldap.secret
Kontrolle
=Stimmt der base dn?
- ldapsearch -x -LLL
dn: dc=it21,dc=int objectClass: top objectClass: dcObject objectClass: organization o: int21 dc: it21
Grundstruktur
Erstellen
- cat /root/struktur.ldif
dn: ou=users,dc=it21,dc=int objectClass: organizationalUnit ou: users dn: ou=groups,dc=it21,dc=int objectClass: organizationalUnit ou: groups dn: ou=hosts,dc=it21,dc=int objectClass: organizationalUnit ou: hosts dn: cn=it,ou=groups,dc=it21,dc=int objectClass: posixGroup cn: it gidNumber: 3001
Anlegen
ldapadd -xD cn=admin,dc=it21,dc=int -w 123Start$ -f struktur.ldif
adding new entry "ou=users,dc=it21,dc=int"
adding new entry "ou=groups,dc=it21,dc=int"
adding new entry "ou=hosts,dc=it21,dc=int"
adding new entry "cn=it,ou=groups,dc=it21,dc=int"
Starten des slapd
systemctl start slapd
Stoppen des slapd
systemctl stop slapd
Neustarten des slapd
systemctl restart slapd
Auf welchem Port lauscht der slapd
netstat -lntp | grep slapd tcp 0 0 0.0.0.0:389 0.0.0.0:* LISTEN 499/slapd
Welche PID hat der slapd
pgrep slapd 499 500 501
Abfragen
anonym
ldapsearch -x -LLL -H ldap://127.0.0.1 -b dc=linuggs,dc=de
gebunden interaktiv
ldapsearch -x -LLL -D "cn=admin, dc=linuggs, dc=de" -W -H ldap://127.0.0.1 -b dc=linuggs,dc=de
gebunden automatisch
ldapsearch -x -LLL -D "cn=admin, dc=linuggs, dc=de" -w sysadm -H ldap://127.0.0.1 -b dc=linuggs,dc=de
Defaultclientkonfiguration von LDAP
gruppe hinzufügen
ldapadd -xD cn=admin,dc=linuggs,dc=de -w sysadm -f group.ldif adding new entry "cn=it,ou=groups,dc=linuggs,dc=de"
user ldif anlegen
dn: uid=leroy,ou=users,dc=linuggs,dc=de cn: leroy objectClass: account objectClass: posixAccount objectClass: shadowAccount uid: leroy uidNumber: 2001 gidNumber: 3001 homeDirectory: /home/leroy loginShell: /bin/bash
user hinzufügen
ldapadd -xD cn=admin,dc=linuggs,dc=de -w sysadm -f user.ldif adding new entry "uid=leroy,ou=user,dc=linuggs,dc=de"
ldapscripts
Openldap posix accounts
ldapsearch
root@maria:~# ldapsearch -x -LLL -b dc=linuggs,dc=de 'uid=thomas' cn gidNumber dn: uid=thomas,ou=People,dc=linuggs,dc=de cn: thomas will gidNumber: 5000
apache2 ldap
ssl
certifikate generieren
ssl.ldif erstellen
dn: cn=config add: olcTLSCACertificateFile olcTLSCACertificateFile: /etc/ldap/ssl/xin-ca.crt - add: olcTLSCertificateFile olcTLSCertificateFile: /etc/ldap/ssl/xin-ca-maria.xinux.org.crt - add: olcTLSCertificateKeyFile olcTLSCertificateKeyFile: /etc/ldap/ssl/xin-ca-maria.xinux.org.key
konfig hinzufügen
ldapmodify -Y EXTERNAL -H ldapi:/// -f ssl.ldif SASL/EXTERNAL authentication started SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth SASL SSF: 0 modifying entry "cn=config
ldaps freischalten
- /etc/default/slapd
SLAPD_SERVICES="ldap:/// ldaps:/// ldapi:///"
slapd restart
systemctl restart slapd
slapd ssl check
- netstat -lntp | grep 636
tcp 0 0 0.0.0.0:636 0.0.0.0:* LISTEN 2204/slapd tcp6 0 0 :::636 :::* LISTEN 2204/slapd
Links
- https://help.ubuntu.com/lts/serverguide/openldap-server.html
- https://help.ubuntu.com/community/OpenLDAPServer
- http://www.plone-entwicklerhandbuch.de/plone-entwicklerhandbuch/authentifizierung/ldap
- http://www.zytrax.com/books/ldap/
- https://wiki.debian.org/LDAP/OpenLDAPSetup
- https://darkstar.gernox.de/2012/10/28/openldap/
- http://www.openldap.org/doc/admin24/
- https://wiki.debian.org/LDAP/OpenLDAPSetup
- http://askubuntu.com/questions/481917/apache2-4-7-ldap-url-authentication-on-ubuntu-14-04
Servertools
slapdadd
User zur SLAPD Datenbank hinzufügen
slapadd -b dc=linuggs,dc=de -l muster.ldif
- -b: Baseroot
- -l: Informationen werden aus der angegebenen Datei gelsen. Nicht vom Standard-Input
slapadd -b dc=linuggs,dc=de -f slapd.conf
- -f: eine alternative slapd.conf benutzen
slapcat
Der Befehl slapcat ermöglicht die Speicherung der aktuellen LDAP-Daten in einer Textdatei im LDIF-Format
slapcat > ldapdaten.txt






