OpenLDAP-Anmeldung auf Client mit belieb. oder ohne Password
OpenLDAP-Anmeldung auf Client mit belieb. oder ohne Password
Hallo,
ich habe in meinem LAN auf meinem Debian-Lenny-Server einen OpenLDAP-Server installiert.
LDAP möchte ich später als Backend für SAMBA verwenden, sowie als Benutzer-Datenbank für Linux-Clients.
Später möchte ich auch DNS und DHCP ins LDAP integrieren.
Fürn Anfang reicht mir schon mal wenn die Anmeldung auf Linux-Clients per LDAP funktioniert.
Den LDAP-Server habe ich mit "apt-get install slapd ldap-utils" installiert und anschließend mit "dpkg-reconfigure slapd" konfiguriert.
Anschließend habe ich noch einige kleinigkeiten händisch an der slapd.conf geändernt (Schemate hinzugefügt, Root-DN angepasst).
Der Server startet einwandfrei und ich kann auch mit den ldap-utils sowie mit JXplorer drauf zugreifen und als Admin auch änderungen durchführen.
Danach habe ich ein frischen Debian Lenny in einer VM augesetzte (Standart-Installation ohne GUI) und mit
"apt-get install libnss-ldapd" den LDAP-Client installiert und gleich konfiguriert.
nscd habe ich gleich mit "apt-get purge nscd" wieder gelöscht um Fehlerquellen mal von vornhinein auszuschließen.
Die "/etc/nsswitch.conf" wurde durch das LDAP-Client-Setup bereits korrekt eingestellt (bei passwd, groups und shadow "ldap" hinzugefügt), so das ich hier nicht nacharbeiten hab müssen.
Nur die Config-Datein "common-auth" "common-account" "common-session" und "common-password" im Ordner "/etc/pam.d" habe ich manuell bearbeiten müssen.
Sicherheitshalber habe ich nach den Änderungen die Client-VM neugestartet.
Nach dem Neustart habe ich gleich versucht mich mit meinem neu angelegten LDAP-User "testuser" einzuloggen, was auch wunderbar funktioniert hat.
"getent passwd" und "getent groups" zeigen auch die LDAP-User und Gruppen korrekt an.
Allerding, habe ich bemerkt das der Login mit dem User "testuser" mit jedem X-bliebigen Passwort funktioniert und das schmeißt natürlich jedes Sicherheitskonzept in den Kübel.
Auch der Befehl "passswd" liefert einen Fehler:
"passwd: Berechtigung verweigert
passwd: password unchanged"
Einloggen per SSH auf die Client-Maschine funktioniert auch nicht ("Access denied" nach der Password-Eingabe).
Die Passwörter sind als SSHA abgelegt, hier habe ich sie ausgeblendet.
Hätte vl hier jemand eine Idee wo das Problem liegen könnte? Ich vermute das das Problem an PAM liegt, nur mit PAM habe ich leider nicht soviel Erfahrung.
Danke im vorraus
ich habe in meinem LAN auf meinem Debian-Lenny-Server einen OpenLDAP-Server installiert.
LDAP möchte ich später als Backend für SAMBA verwenden, sowie als Benutzer-Datenbank für Linux-Clients.
Später möchte ich auch DNS und DHCP ins LDAP integrieren.
Fürn Anfang reicht mir schon mal wenn die Anmeldung auf Linux-Clients per LDAP funktioniert.
Den LDAP-Server habe ich mit "apt-get install slapd ldap-utils" installiert und anschließend mit "dpkg-reconfigure slapd" konfiguriert.
Anschließend habe ich noch einige kleinigkeiten händisch an der slapd.conf geändernt (Schemate hinzugefügt, Root-DN angepasst).
Der Server startet einwandfrei und ich kann auch mit den ldap-utils sowie mit JXplorer drauf zugreifen und als Admin auch änderungen durchführen.
Danach habe ich ein frischen Debian Lenny in einer VM augesetzte (Standart-Installation ohne GUI) und mit
"apt-get install libnss-ldapd" den LDAP-Client installiert und gleich konfiguriert.
nscd habe ich gleich mit "apt-get purge nscd" wieder gelöscht um Fehlerquellen mal von vornhinein auszuschließen.
Die "/etc/nsswitch.conf" wurde durch das LDAP-Client-Setup bereits korrekt eingestellt (bei passwd, groups und shadow "ldap" hinzugefügt), so das ich hier nicht nacharbeiten hab müssen.
Nur die Config-Datein "common-auth" "common-account" "common-session" und "common-password" im Ordner "/etc/pam.d" habe ich manuell bearbeiten müssen.
Sicherheitshalber habe ich nach den Änderungen die Client-VM neugestartet.
Nach dem Neustart habe ich gleich versucht mich mit meinem neu angelegten LDAP-User "testuser" einzuloggen, was auch wunderbar funktioniert hat.
"getent passwd" und "getent groups" zeigen auch die LDAP-User und Gruppen korrekt an.
Allerding, habe ich bemerkt das der Login mit dem User "testuser" mit jedem X-bliebigen Passwort funktioniert und das schmeißt natürlich jedes Sicherheitskonzept in den Kübel.
Auch der Befehl "passswd" liefert einen Fehler:
"passwd: Berechtigung verweigert
passwd: password unchanged"
Einloggen per SSH auf die Client-Maschine funktioniert auch nicht ("Access denied" nach der Password-Eingabe).
Die Passwörter sind als SSHA abgelegt, hier habe ich sie ausgeblendet.
Hätte vl hier jemand eine Idee wo das Problem liegen könnte? Ich vermute das das Problem an PAM liegt, nur mit PAM habe ich leider nicht soviel Erfahrung.
Danke im vorraus
Re: OpenLDAP-Anmeldung auf Client mit belieb. oder ohne Pass
Hallo,
zeig uns doch mal deine editierten common-* Dateien. Ich vermute da ist der Fehler begraben (genauer gesagt in der common-auth)
Gruss
Martin
zeig uns doch mal deine editierten common-* Dateien. Ich vermute da ist der Fehler begraben (genauer gesagt in der common-auth)
Gruss
Martin
Re: OpenLDAP-Anmeldung auf Client mit belieb. oder ohne Pass
okay,
hier die common-auth:
common-account:
common-session:
und common-password:
hier die common-auth:
Code: Alles auswählen
#
# /etc/pam.d/common-auth - authentication settings common to all services
#
# This file is included from other service-specific PAM config files,
# and should contain a list of the authentication modules that define
# the central authentication scheme for use on the system
# (e.g., /etc/shadow, LDAP, Kerberos, etc.). The default is to use the
# traditional Unix authentication mechanisms.
#
auth sufficient pam_unix.so nullok_secure
auth sufficient pam_ldap.so
Code: Alles auswählen
#
# /etc/pam.d/common-account - authorization settings common to all services
#
# This file is included from other service-specific PAM config files,
# and should contain a list of the authorization modules that define
# the central access policy for use on the system. The default is to
# only deny service to users whose accounts are expired in /etc/shadow.
#
account sufficient pam_ldap.so
account sufficient pam_unix.so
Code: Alles auswählen
#
# /etc/pam.d/common-session - session-related modules common to all services
#
# This file is included from other service-specific PAM config files,
# and should contain a list of modules that define tasks to be performed
# at the start and end of sessions of *any* kind (both interactive and
# non-interactive). The default is pam_unix.
#
session sufficient pam_ldap.so
session sufficient pam_unix.so
Code: Alles auswählen
#
# /etc/pam.d/common-password - password-related modules common to all services
#
# This file is included from other service-specific PAM config files,
# and should contain a list of modules that define the services to be
# used to change user passwords. The default is pam_unix.
# Explanation of pam_unix options:
#
# The "nullok" option allows users to change an empty password, else
# empty passwords are treated as locked accounts.
#
# The "md5" option enables MD5 passwords. Without this option, the
# default is Unix crypt.
#
# The "obscure" option replaces the old `OBSCURE_CHECKS_ENAB' option in
# login.defs.
#
# You can also use the "min" option to enforce the length of the new
# password.
#
# See the pam_unix manpage for other options.
password sufficient pam_unix.so nullok obscure md5
password sufficient pam_ldap.so
# Alternate strength checking for password. Note that this
# requires the libpam-cracklib package to be installed.
# You will need to comment out the password line above and
# uncomment the next two in order to use this.
# (Replaces the `OBSCURE_CHECKS_ENAB', `CRACKLIB_DICTPATH')
#
# password required pam_cracklib.so retry=3 minlen=6 difok=3
# password required pam_unix.so use_authtok nullok md5
Re: OpenLDAP-Anmeldung auf Client mit belieb. oder ohne Pass
Hallo
http://snow.nl/dist/xhtmlc/ch10s04.html
Schau dir nochmal die Erklärung des control Feldes an.
common-auth
Du solltest mindestens ein Modul als required drin haben, da fehlgeschlagen sufficient Module das Endergebnis nicht beeinflussen. Wenn es nur 2 Module mit sufficient gibt, könnte man auch genausogut nichts reinschreiben, was dann einem Erfolg ohne irgendwas gleichkommt.
http://snow.nl/dist/xhtmlc/ch10s04.html
Schau dir nochmal die Erklärung des control Feldes an.
common-auth
Code: Alles auswählen
#
# /etc/pam.d/common-auth - authentication settings common to all services
#
# This file is included from other service-specific PAM config files,
# and should contain a list of the authentication modules that define
# the central authentication scheme for use on the system
# (e.g., /etc/shadow, LDAP, Kerberos, etc.). The default is to use the
# traditional Unix authentication mechanisms.
#
auth required pam_unix.so nullok_secure
auth sufficient pam_ldap.so
Re: OpenLDAP-Anmeldung auf Client mit belieb. oder ohne Pass
hmmm ... ich hätte das Schlüsselwort "sufficient" so zu sagen als "oder"-Bedingung aufgefasst, also das die Prozedur erfolgreich ist, wenn einer der beiden Bedinungen erfolgreich durchgegangen ist
Ich werd das Schlüsselwort "required" mal ausprobieren, danke mal für den Tipp
Ich werd das Schlüsselwort "required" mal ausprobieren, danke mal für den Tipp
Re: OpenLDAP-Anmeldung auf Client mit belieb. oder ohne Pass
Hmm ... Der Tipp hat leider auch nicht funktionier, ich hab dann noch versucht die Dateien so anzupassen:
account:
auth:
wenn ich diese Einstellungen verwende funktioniert der Login mit dem LDAP-User gar nicht "Login incorrect".
vl kann man was aus der Auth.log herauslesen (direkt nach dem Start):
account:
Code: Alles auswählen
# /etc/pam.d/common-account - authorization settings common to all services
#
# This file is included from other service-specific PAM config files,
# and should contain a list of the authorization modules that define
# the central access policy for use on the system. The default is to
# only deny service to users whose accounts are expired in /etc/shadow.
#
account sufficient pam_ldap.so
account required pam_unix.so
Code: Alles auswählen
#
# /etc/pam.d/common-auth - authentication settings common to all services
#
# This file is included from other service-specific PAM config files,
# and should contain a list of the authentication modules that define
# the central authentication scheme for use on the system
# (e.g., /etc/shadow, LDAP, Kerberos, etc.). The default is to use the
# traditional Unix authentication mechanisms.
#
auth sufficient pam_ldap.so
auth required pam_unix.so nullok_secure
vl kann man was aus der Auth.log herauslesen (direkt nach dem Start):
Code: Alles auswählen
Nov 10 19:49:54 lnx-tst-clnt sshd[2114]: Server listening on :: port 22.
Nov 10 19:49:54 lnx-tst-clnt sshd[2114]: Server listening on 0.0.0.0 port 22.
Nov 10 19:50:00 lnx-tst-clnt sshd[2114]: Received signal 15; terminating.
Nov 10 19:50:00 lnx-tst-clnt sshd[2502]: Server listening on :: port 22.
Nov 10 19:50:00 lnx-tst-clnt sshd[2502]: Server listening on 0.0.0.0 port 22.
Nov 10 19:50:06 lnx-tst-clnt login[2449]: pam_ldap: ldap_simple_bind Can't contact LDAP server
Nov 10 19:50:06 lnx-tst-clnt login[2449]: pam_ldap: reconnecting to LDAP server...
Nov 10 19:50:06 lnx-tst-clnt login[2449]: pam_ldap: ldap_simple_bind Can't contact LDAP server
Nov 10 19:50:08 lnx-tst-clnt login[2449]: pam_unix(login:auth): authentication failure; logname=LOGIN uid=0 euid=0 tty=tty1 ruser= rhost= user=testuser
Nov 10 19:50:11 lnx-tst-clnt login[2449]: FAILED LOGIN (1) on 'tty1' FOR `testuser', Authentication failure
Nov 10 19:50:16 lnx-tst-clnt login[2449]: pam_ldap: ldap_simple_bind Can't contact LDAP server
Nov 10 19:50:16 lnx-tst-clnt login[2449]: pam_ldap: reconnecting to LDAP server...
Nov 10 19:50:16 lnx-tst-clnt login[2449]: pam_ldap: ldap_simple_bind Can't contact LDAP server
Nov 10 19:50:19 lnx-tst-clnt login[2449]: pam_ldap: ldap_simple_bind Can't contact LDAP server
Nov 10 19:50:19 lnx-tst-clnt login[2449]: pam_ldap: ldap_simple_bind Can't contact LDAP server
Nov 10 19:50:19 lnx-tst-clnt login[2449]: pam_ldap: reconnecting to LDAP server...
Nov 10 19:50:19 lnx-tst-clnt login[2449]: pam_ldap: ldap_simple_bind Can't contact LDAP server
Nov 10 19:50:19 lnx-tst-clnt login[2503]: ROOT LOGIN on 'tty1'
Nov 10 19:55:38 lnx-tst-clnt sshd[2520]: pam_ldap: ldap_simple_bind Can't contact LDAP server
Nov 10 19:55:38 lnx-tst-clnt sshd[2520]: pam_ldap: reconnecting to LDAP server...
Nov 10 19:55:38 lnx-tst-clnt sshd[2520]: pam_ldap: ldap_simple_bind Can't contact LDAP server
Nov 10 19:55:38 lnx-tst-clnt sshd[2520]: pam_ldap: ldap_simple_bind Can't contact LDAP server
Nov 10 19:55:38 lnx-tst-clnt sshd[2520]: pam_ldap: reconnecting to LDAP server...
Nov 10 19:55:38 lnx-tst-clnt sshd[2520]: pam_ldap: ldap_simple_bind Can't contact LDAP server
Re: OpenLDAP-Anmeldung auf Client mit belieb. oder ohne Pass
Hallo,
da kann man ja schön erkennen, dass er sich nicht zum LDAP Server verbinden kann.
Stehen in /etc/pam_ldap.conf die richtigen Werte zum Verbinden drinnen? (siehe man 5 pam_ldap.conf)
Gruss
Martin
da kann man ja schön erkennen, dass er sich nicht zum LDAP Server verbinden kann.
Stehen in /etc/pam_ldap.conf die richtigen Werte zum Verbinden drinnen? (siehe man 5 pam_ldap.conf)
Gruss
Martin
Re: OpenLDAP-Anmeldung auf Client mit belieb. oder ohne Pass
super jetzt funktionierts.
Der Fehler lag tatsächlich in der pam_ldap.conf.
dpgk-recofigure hat als Serveradresse lapi://mastertux.cc-network.at/ eingetragen.
ich habe diese Zeile auskommentiert und stattdesen die "Parametet" host und port verwenden und siehe da es funktioniert, auch der Password wechsel, thx
Der Fehler lag tatsächlich in der pam_ldap.conf.
dpgk-recofigure hat als Serveradresse lapi://mastertux.cc-network.at/ eingetragen.
ich habe diese Zeile auskommentiert und stattdesen die "Parametet" host und port verwenden und siehe da es funktioniert, auch der Password wechsel, thx
Re: OpenLDAP-Anmeldung auf Client mit belieb. oder ohne Pass
okay, ldap-auth am client und auch am server selbst funktioniert jetzt.
Nur bin ich auf ein weiteres Problem gestoßen, eigentlich nur ein Schönheitsfehler.
Die motd und Mail-Benachrichtigung werden nach dem Login nicht mehr angezeigt, auch nicht wenn der login über ssh erfolgt.
Die beiden Dinge werden doch auch über pam gesteuert, nur verstehe ich nicht warum sie nach hinzufügen der LDAP-Module nicht mehr funktionieren o.O
Nur bin ich auf ein weiteres Problem gestoßen, eigentlich nur ein Schönheitsfehler.
Die motd und Mail-Benachrichtigung werden nach dem Login nicht mehr angezeigt, auch nicht wenn der login über ssh erfolgt.
Die beiden Dinge werden doch auch über pam gesteuert, nur verstehe ich nicht warum sie nach hinzufügen der LDAP-Module nicht mehr funktionieren o.O
Re: OpenLDAP-Anmeldung auf Client mit belieb. oder ohne Pass
Hi,
poste uns für das Problem mal deine /etc/pam.d/ssh
Dort wird defaultmässig pam_motd als optionales Sessionmodul eingebunden.
Gruss
Martin
poste uns für das Problem mal deine /etc/pam.d/ssh
Dort wird defaultmässig pam_motd als optionales Sessionmodul eingebunden.
Gruss
Martin