LDAPS (LDAP over TLS/SSL): Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
| Zeile 11: | Zeile 11: | ||
;Der private Schlüssel | ;Der private Schlüssel | ||
/etc/ssl/own.key | /etc/ssl/own.key | ||
| + | = Rechte für den slapd anpassen = | ||
| + | * Der User openldap muss den privaten Schlüssel lesen können: | ||
| + | chown openldap:openldap /etc/ssl/own.crt /etc/ssl/own.key | ||
| + | chmod 640 /etc/ssl/own.key | ||
| + | |||
| + | = LDIF-Datei für die TLS-Konfiguration erstellen = | ||
| + | * Datei: tls_config.ldif | ||
| + | dn: cn=config | ||
| + | changetype: modify | ||
| + | replace: olcTLSCertificateFile | ||
| + | olcTLSCertificateFile: /etc/ssl/own.crt | ||
| + | - | ||
| + | replace: olcTLSCertificateKeyFile | ||
| + | olcTLSCertificateKeyFile: /etc/ssl/own.key | ||
| + | |||
| + | = Konfiguration einspielen = | ||
| + | * Die Änderung direkt in die cn=config schreiben: | ||
| + | ldapmodify -Q -Y EXTERNAL -H ldapi:/// -f tls_config.ldif | ||
| + | |||
| + | = Ports in /etc/default/slapd prüfen = | ||
| + | * Sicherstellen, dass ldaps aktiviert ist: | ||
| + | SLAPD_SERVICES="ldap:/// ldapi:/// ldaps:///" | ||
| + | |||
| + | = Dienst neu starten = | ||
| + | systemctl restart slapd | ||
| + | |||
| + | = Funktionstest = | ||
| + | * Prüfen, ob der Server das Zertifikat auf Port 636 ausliefert: | ||
| + | openssl s_client -connect localhost:636 -showcerts | ||
Version vom 2. April 2026, 12:05 Uhr
Wo sind wir?
- Wir befinden uns auf dem LDAP Server.
- Dort kommt KEY und CERT rein.
Wir holen uns ein Zertifkat une ein Schlüssel
- wget https://xinux.de/downloads/script/get-cert.sh
- chmod +x get-cert.sh
- get-cert.sh
Sie liegen unter /etc/ssl/
- Das Zertifilat
/etc/ssl/own.crt
- Der private Schlüssel
/etc/ssl/own.key
Rechte für den slapd anpassen
- Der User openldap muss den privaten Schlüssel lesen können:
chown openldap:openldap /etc/ssl/own.crt /etc/ssl/own.key chmod 640 /etc/ssl/own.key
LDIF-Datei für die TLS-Konfiguration erstellen
- Datei: tls_config.ldif
dn: cn=config changetype: modify replace: olcTLSCertificateFile olcTLSCertificateFile: /etc/ssl/own.crt - replace: olcTLSCertificateKeyFile olcTLSCertificateKeyFile: /etc/ssl/own.key
Konfiguration einspielen
- Die Änderung direkt in die cn=config schreiben:
ldapmodify -Q -Y EXTERNAL -H ldapi:/// -f tls_config.ldif
Ports in /etc/default/slapd prüfen
- Sicherstellen, dass ldaps aktiviert ist:
SLAPD_SERVICES="ldap:/// ldapi:/// ldaps:///"
Dienst neu starten
systemctl restart slapd
Funktionstest
- Prüfen, ob der Server das Zertifikat auf Port 636 ausliefert:
openssl s_client -connect localhost:636 -showcerts