From 282418ab91759ccdc3308c38d1236ffc14a59ac1 Mon Sep 17 00:00:00 2001 From: Jochen Mehlich Date: Sat, 24 Oct 2026 11:13:17 +0200 Subject: [PATCH] check-sshd-ldap.sh: sssctl optional, direkte ldapsearch-Abfrage und sssd-Log; setup installiert sssd-tools Co-Authored-By: Claude Sonnet 5.5 --- check-sshd-ldap.sh | 16 +++++++++++++++- setup-sshd-ldap.sh | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/check-sshd-ldap.sh b/check-sshd-ldap.sh index a0e417a..6cd7073 100755 --- a/check-sshd-ldap.sh +++ b/check-sshd-ldap.sh @@ -28,7 +28,21 @@ check "SSH-Keys-Abfrage funktioniert (Aufruf)" sss_ssh_authorizedkeys "$USER_NA echo echo "── getent passwd $USER_NAME"; getent passwd "$USER_NAME" || true echo "── id $USER_NAME"; id "$USER_NAME" 2>&1 || true -echo "── sssctl domain-status authentik"; sssctl domain-status authentik 2>&1 | head -n 15 || true +if command -v sssctl >/dev/null; then + echo "── sssctl domain-status authentik"; sssctl domain-status authentik 2>&1 | head -n 15 || true +else + echo "── sssctl fehlt (apt install sssd-tools)" +fi + +# Direkte LDAP-Abfrage mit den Daten aus sssd.conf: trennt Outpost-/Bind-Probleme von SSSD-Problemen +conf() { awk -F' *= *' -v k="$1" '$1 == k { print $2; exit }' /etc/sssd/sssd.conf 2>/dev/null; } +if command -v ldapsearch >/dev/null && [[ -r /etc/sssd/sssd.conf ]]; then + echo "── ldapsearch (cn=$USER_NAME)" + LDAPTLS_CACERT="$(conf ldap_tls_cacert)" ldapsearch -LLL -H "$(conf ldap_uri)" -D "$(conf ldap_default_bind_dn)" \ + -y <(printf %s "$(conf ldap_default_authtok)") -b "$(conf ldap_search_base)" \ + "(cn=$USER_NAME)" dn cn memberOf homeDirectory 2>&1 | head -n 20 || true +fi +echo "── sssd-Log (letzte Zeilen)"; journalctl -u sssd -n 15 --no-pager 2>&1 | tail -n 15 || true if [[ $fail -ne 0 ]]; then echo diff --git a/setup-sshd-ldap.sh b/setup-sshd-ldap.sh index 745b310..9c04783 100755 --- a/setup-sshd-ldap.sh +++ b/setup-sshd-ldap.sh @@ -79,7 +79,7 @@ DOCKER_GROUP="server_${SERVER}_docker_compose" # ── Pakete ─────────────────────────────────────────────────────────────────── log "📦 Pakete installieren" DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ - sssd sssd-ldap libnss-sss libpam-sss libsss-sudo openssh-server ldap-utils >/dev/null + sssd sssd-ldap libnss-sss libpam-sss libsss-sudo sssd-tools openssh-server ldap-utils >/dev/null # ── CA ─────────────────────────────────────────────────────────────────────── TLS_CACERT_LINE="# ldap_tls_cacert: System-CA-Store"