LDAPS (LDAP over TLS/SSL): Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
| Zeile 2: | Zeile 2: | ||
;Wir befinden uns auf dem LDAP Server. | ;Wir befinden uns auf dem LDAP Server. | ||
;Dort kommt KEY und CERT rein. | ;Dort kommt KEY und CERT rein. | ||
| − | =Wir holen uns ein Zertifkat une ein Schlüssel= | + | ==Wir holen uns ein Zertifkat une ein Schlüssel== |
*wget https://xinux.de/downloads/script/get-cert.sh | *wget https://xinux.de/downloads/script/get-cert.sh | ||
*chmod +x get-cert.sh | *chmod +x get-cert.sh | ||
*get-cert.sh | *get-cert.sh | ||
| − | =Sie liegen unter /etc/ssl/= | + | ==Sie liegen unter /etc/ssl/== |
;Das Zertifilat | ;Das Zertifilat | ||
/etc/ssl/own.crt | /etc/ssl/own.crt | ||
;Der private Schlüssel | ;Der private Schlüssel | ||
/etc/ssl/own.key | /etc/ssl/own.key | ||
| − | = Rechte für den slapd anpassen = | + | == Rechte für den slapd anpassen == |
Der User openldap muss den privaten Schlüssel lesen können: | Der User openldap muss den privaten Schlüssel lesen können: | ||
*chown openldap:openldap /etc/ssl/own.crt /etc/ssl/own.key | *chown openldap:openldap /etc/ssl/own.crt /etc/ssl/own.key | ||
*chmod 640 /etc/ssl/own.key | *chmod 640 /etc/ssl/own.key | ||
| − | = LDIF-Datei für die TLS-Konfiguration erstellen = | + | == LDIF-Datei für die TLS-Konfiguration erstellen == |
*vi /root/tls_config.ldif | *vi /root/tls_config.ldif | ||
dn: cn=config | dn: cn=config | ||
| Zeile 26: | Zeile 26: | ||
olcTLSCertificateKeyFile: /etc/ssl/own.key | olcTLSCertificateKeyFile: /etc/ssl/own.key | ||
| − | = Konfiguration einspielen = | + | == Konfiguration einspielen == |
Die Änderung direkt in die cn=config schreiben: | Die Änderung direkt in die cn=config schreiben: | ||
*ldapmodify -Q -Y EXTERNAL -H ldapi:/// -f /root/tls_config.ldif | *ldapmodify -Q -Y EXTERNAL -H ldapi:/// -f /root/tls_config.ldif | ||
| − | = Ports in /etc/default/slapd anpassen = | + | == Ports in /etc/default/slapd anpassen == |
Sicherstellen, dass ldaps aktiviert ist: | Sicherstellen, dass ldaps aktiviert ist: | ||
SLAPD_SERVICES="ldap:/// ldapi:/// ldaps:///" | SLAPD_SERVICES="ldap:/// ldapi:/// ldaps:///" | ||
| − | = Dienst neu starten = | + | == Dienst neu starten == |
*systemctl restart slapd | *systemctl restart slapd | ||
| − | =Ports prüfen= | + | ==Ports prüfen== |
*ss -4lntp | grep slapd | *ss -4lntp | grep slapd | ||
LISTEN 0 2048 0.0.0.0:636 0.0.0.0:* users:(("slapd",pid=788,fd=10)) | LISTEN 0 2048 0.0.0.0:636 0.0.0.0:* users:(("slapd",pid=788,fd=10)) | ||
| Zeile 45: | Zeile 45: | ||
*openssl s_client -connect ldap.it213.int:636 -showcerts | *openssl s_client -connect ldap.it213.int:636 -showcerts | ||
=Nun zu den Clients= | =Nun zu den Clients= | ||
| + | == Funktionstest == | ||
| + | Prüfen, ob der Server das Zertifikat auf Port 636 ausliefert: | ||
| + | *openssl s_client -connect ldap.it213.int:636 -showcerts | ||
Version vom 2. April 2026, 12:15 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
- vi /root/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 /root/tls_config.ldif
Ports in /etc/default/slapd anpassen
Sicherstellen, dass ldaps aktiviert ist:
SLAPD_SERVICES="ldap:/// ldapi:/// ldaps:///"
Dienst neu starten
- systemctl restart slapd
Ports prüfen
- ss -4lntp | grep slapd
LISTEN 0 2048 0.0.0.0:636 0.0.0.0:* users:(("slapd",pid=788,fd=10))
LISTEN 0 2048 0.0.0.0:389 0.0.0.0:* users:(("slapd",pid=788,fd=7))
Funktionstest
Prüfen, ob der Server das Zertifikat auf Port 636 ausliefert:
- openssl s_client -connect ldap.it213.int:636 -showcerts
Nun zu den Clients
Funktionstest
Prüfen, ob der Server das Zertifikat auf Port 636 ausliefert:
- openssl s_client -connect ldap.it213.int:636 -showcerts