Zentrale Benutzerverwaltung mit OpenLDAP und SSS: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
| (29 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
| Zeile 3: | Zeile 3: | ||
* apt update | * apt update | ||
* DEBIAN_FRONTEND=noninteractive apt install -y slapd ldap-utils | * DEBIAN_FRONTEND=noninteractive apt install -y slapd ldap-utils | ||
| − | |||
| − | |||
| − | |||
= Grundkonfiguration = | = Grundkonfiguration = | ||
* dpkg-reconfigure slapd | * dpkg-reconfigure slapd | ||
| − | |||
| − | |||
{| class="wikitable" | {| class="wikitable" | ||
| − | ! Debconf Question | + | ! Debconf Question !! Recommended Input |
| − | |||
| − | |||
|- | |- | ||
| − | | | + | | Omit OpenLDAP server configuration? || No |
|- | |- | ||
| − | | | + | | DNS domain name: || it213.int |
|- | |- | ||
| − | | | + | | Organization name: || it213 |
|- | |- | ||
| − | | | + | | Administrator password: || 123Start$ |
|- | |- | ||
| − | | | + | | Database backend to use: || MDB |
|- | |- | ||
| − | | | + | | Remove database when slapd is purged? || No |
|- | |- | ||
| − | | | + | | Move old database? || Yes |
|- | |- | ||
| − | | | + | | Allow LDAPv2 protocol? || No |
|} | |} | ||
| − | + | = ldap.conf setzen = | |
| − | + | * vim /etc/ldap/ldap.conf | |
| − | + | <pre> | |
| − | + | BASE dc=it213,dc=int | |
| − | + | URI ldap://ldap.it213.int | |
| − | * | + | ldap_version 3 |
| − | + | </pre> | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
= Kontrolle = | = Kontrolle = | ||
| − | |||
* ldapsearch -x -LLL | * ldapsearch -x -LLL | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
= Grundstruktur = | = Grundstruktur = | ||
| − | + | == Erstellen == | |
| + | * cat <<EOF > /root/struktur.ldif | ||
| + | <pre> | ||
| + | dn: ou=users,dc=it213,dc=int | ||
| + | objectClass: organizationalUnit | ||
| + | ou: users | ||
| − | + | dn: ou=groups,dc=it213,dc=int | |
| − | + | objectClass: organizationalUnit | |
| − | + | ou: groups | |
| − | + | ||
| − | + | dn: ou=hosts,dc=it213,dc=int | |
| − | + | objectClass: organizationalUnit | |
| − | + | ou: hosts | |
| − | + | ||
| − | + | dn: ou=sudo,dc=it213,dc=int | |
| − | + | objectClass: organizationalUnit | |
| − | + | ou: sudo | |
| − | + | </pre> | |
| − | + | EOF | |
== Anlegen == | == Anlegen == | ||
| − | * ldapadd -xD cn=admin,dc=it213,dc=int -w 123Start$ -f struktur.ldif | + | * ldapadd -xD cn=admin,dc=it213,dc=int -w 123Start$ -f /root/struktur.ldif |
| − | |||
| − | |||
| − | |||
| − | = | + | = Benutzer und Gruppen = |
| − | + | * apt install -y ldapscripts | |
| − | * apt install ldapscripts | ||
== Konfiguration == | == Konfiguration == | ||
| − | + | * vim /etc/ldapscripts/ldapscripts.conf | |
| − | * | + | <pre> |
| − | + | SERVER="ldap://ldap.it213.int" | |
| − | + | SUFFIX="dc=it213,dc=int" | |
| − | + | GSUFFIX="ou=groups" | |
| − | + | USUFFIX="ou=users" | |
| − | + | MSUFFIX="ou=hosts" | |
| − | + | BINDDN="cn=admin,dc=it213,dc=int" | |
| − | + | USHELL="/bin/bash" | |
| − | + | UHOMES="/home/%u" | |
| − | + | CREATEHOMES="yes" | |
| − | + | HOMESKEL="/etc/skel" | |
| − | + | BINDPWDFILE="/etc/ldapscripts/ldapscripts.passwd" | |
| − | + | GIDSTART="10000" # Group ID | |
| − | + | UIDSTART="10000" # User ID | |
| − | + | MIDSTART="20000" # Machine ID | |
| − | + | GCLASS="posixGroup" # Leave "posixGroup" here if not sure ! | |
| − | + | PASSWORDGEN="pwgen" | |
| − | + | RECORDPASSWORDS="no" | |
| − | + | PASSWORDFILE="/var/log/ldapscripts_passwd.log" | |
| − | + | LOGTOFILE="yes" | |
| − | + | LOGFILE="/var/log/ldapscripts.log" | |
| − | + | LOGTOSYSLOG="no" | |
| − | + | SYSLOGFACILITY="local4" | |
| − | + | SYSLOGLEVEL="info" | |
| − | + | LDAPSEARCHBIN="/usr/bin/ldapsearch" | |
| − | + | LDAPADDBIN="/usr/bin/ldapadd" | |
| − | + | LDAPDELETEBIN="/usr/bin/ldapdelete" | |
| − | + | LDAPMODIFYBIN="/usr/bin/ldapmodify" | |
| − | + | LDAPMODRDNBIN="/usr/bin/ldapmodrdn" | |
| − | + | LDAPPASSWDBIN="/usr/bin/ldappasswd" | |
| − | + | LDAPSEARCHOPTS="-o ldif-wrap=no" | |
| + | GETENTPWCMD="" | ||
| + | GETENTGRCMD="" | ||
| + | GTEMPLATE="" | ||
| + | UTEMPLATE="" | ||
| + | MTEMPLATE="" | ||
| + | </pre> | ||
| − | |||
* echo -n "123Start$" > /etc/ldapscripts/ldapscripts.passwd | * echo -n "123Start$" > /etc/ldapscripts/ldapscripts.passwd | ||
| + | * chmod 600 /etc/ldapscripts/ldapscripts.passwd | ||
| − | + | == Gruppen == | |
| − | |||
| − | |||
| − | |||
| − | |||
* ldapaddgroup it | * ldapaddgroup it | ||
| + | * ldapaddgroup sudo | ||
| − | + | == Benutzer == | |
* ldapadduser thomas it | * ldapadduser thomas it | ||
* ldapadduser tina it | * ldapadduser tina it | ||
| − | == | + | == Passwort == |
* ldapsetpasswd thomas | * ldapsetpasswd thomas | ||
* ldapsetpasswd tina | * ldapsetpasswd tina | ||
| − | = | + | == Gruppe zuweisen == |
| − | + | * ldapaddusertogroup thomas sudo | |
| + | * ldapaddusertogroup tina sudo | ||
| − | = | + | = SSSD Anbindung = |
* apt install sssd libnss-sss libpam-sss libsss-sudo | * apt install sssd libnss-sss libpam-sss libsss-sudo | ||
| − | == | + | == Konfiguration == |
* vim /etc/sssd/sssd.conf | * vim /etc/sssd/sssd.conf | ||
<pre> | <pre> | ||
[sssd] | [sssd] | ||
| + | config_file_version = 2 | ||
services = nss, pam, sudo | services = nss, pam, sudo | ||
domains = it213.int | domains = it213.int | ||
| Zeile 154: | Zeile 139: | ||
id_provider = ldap | id_provider = ldap | ||
auth_provider = ldap | auth_provider = ldap | ||
| + | access_provider = permit | ||
sudo_provider = ldap | sudo_provider = ldap | ||
ldap_uri = ldap://ldap.it213.int | ldap_uri = ldap://ldap.it213.int | ||
| Zeile 159: | Zeile 145: | ||
ldap_sudo_search_base = ou=sudo,dc=it213,dc=int | ldap_sudo_search_base = ou=sudo,dc=it213,dc=int | ||
ldap_id_use_start_tls = false | ldap_id_use_start_tls = false | ||
| − | + | ldap_auth_disable_tls_never_use_in_production = true | |
| − | ldap_tls_reqcert = | + | ldap_tls_reqcert = never |
</pre> | </pre> | ||
| + | ;[[Erklärungen sssd-1]] | ||
| + | |||
* chmod 600 /etc/sssd/sssd.conf | * chmod 600 /etc/sssd/sssd.conf | ||
* systemctl restart sssd | * systemctl restart sssd | ||
| − | == | + | == NSS == |
| − | * cat /etc/nsswitch.conf | + | ;Nur Kontrolle |
| + | *cat /etc/nsswitch.conf | ||
<pre> | <pre> | ||
| + | |||
passwd: files systemd sss | passwd: files systemd sss | ||
group: files systemd sss | group: files systemd sss | ||
| Zeile 186: | Zeile 176: | ||
</pre> | </pre> | ||
| − | == PAM | + | == PAM == |
| − | * pam-auth-update --enable mkhomedir | + | * pam-auth-update --enable sss mkhomedir |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
Aktuelle Version vom 2. April 2026, 10:55 Uhr
Installation
- passwort nach wahl festlegen
- apt update
- DEBIAN_FRONTEND=noninteractive apt install -y slapd ldap-utils
Grundkonfiguration
- dpkg-reconfigure slapd
| Debconf Question | Recommended Input |
|---|---|
| Omit OpenLDAP server configuration? | No |
| DNS domain name: | it213.int |
| Organization name: | it213 |
| Administrator password: | 123Start$ |
| Database backend to use: | MDB |
| Remove database when slapd is purged? | No |
| Move old database? | Yes |
| Allow LDAPv2 protocol? | No |
ldap.conf setzen
- vim /etc/ldap/ldap.conf
BASE dc=it213,dc=int URI ldap://ldap.it213.int ldap_version 3
Kontrolle
- ldapsearch -x -LLL
Grundstruktur
Erstellen
- cat <<EOF > /root/struktur.ldif
dn: ou=users,dc=it213,dc=int objectClass: organizationalUnit ou: users dn: ou=groups,dc=it213,dc=int objectClass: organizationalUnit ou: groups dn: ou=hosts,dc=it213,dc=int objectClass: organizationalUnit ou: hosts dn: ou=sudo,dc=it213,dc=int objectClass: organizationalUnit ou: sudo
EOF
Anlegen
- ldapadd -xD cn=admin,dc=it213,dc=int -w 123Start$ -f /root/struktur.ldif
Benutzer und Gruppen
- apt install -y ldapscripts
Konfiguration
- vim /etc/ldapscripts/ldapscripts.conf
SERVER="ldap://ldap.it213.int" SUFFIX="dc=it213,dc=int" GSUFFIX="ou=groups" USUFFIX="ou=users" MSUFFIX="ou=hosts" BINDDN="cn=admin,dc=it213,dc=int" USHELL="/bin/bash" UHOMES="/home/%u" CREATEHOMES="yes" HOMESKEL="/etc/skel" BINDPWDFILE="/etc/ldapscripts/ldapscripts.passwd" GIDSTART="10000" # Group ID UIDSTART="10000" # User ID MIDSTART="20000" # Machine ID GCLASS="posixGroup" # Leave "posixGroup" here if not sure ! PASSWORDGEN="pwgen" RECORDPASSWORDS="no" PASSWORDFILE="/var/log/ldapscripts_passwd.log" LOGTOFILE="yes" LOGFILE="/var/log/ldapscripts.log" LOGTOSYSLOG="no" SYSLOGFACILITY="local4" SYSLOGLEVEL="info" LDAPSEARCHBIN="/usr/bin/ldapsearch" LDAPADDBIN="/usr/bin/ldapadd" LDAPDELETEBIN="/usr/bin/ldapdelete" LDAPMODIFYBIN="/usr/bin/ldapmodify" LDAPMODRDNBIN="/usr/bin/ldapmodrdn" LDAPPASSWDBIN="/usr/bin/ldappasswd" LDAPSEARCHOPTS="-o ldif-wrap=no" GETENTPWCMD="" GETENTGRCMD="" GTEMPLATE="" UTEMPLATE="" MTEMPLATE=""
- echo -n "123Start$" > /etc/ldapscripts/ldapscripts.passwd
- chmod 600 /etc/ldapscripts/ldapscripts.passwd
Gruppen
- ldapaddgroup it
- ldapaddgroup sudo
Benutzer
- ldapadduser thomas it
- ldapadduser tina it
Passwort
- ldapsetpasswd thomas
- ldapsetpasswd tina
Gruppe zuweisen
- ldapaddusertogroup thomas sudo
- ldapaddusertogroup tina sudo
SSSD Anbindung
- apt install sssd libnss-sss libpam-sss libsss-sudo
Konfiguration
- vim /etc/sssd/sssd.conf
[sssd] config_file_version = 2 services = nss, pam, sudo domains = it213.int [domain/it213.int] id_provider = ldap auth_provider = ldap access_provider = permit sudo_provider = ldap ldap_uri = ldap://ldap.it213.int ldap_search_base = dc=it213,dc=int ldap_sudo_search_base = ou=sudo,dc=it213,dc=int ldap_id_use_start_tls = false ldap_auth_disable_tls_never_use_in_production = true ldap_tls_reqcert = never
- chmod 600 /etc/sssd/sssd.conf
- systemctl restart sssd
NSS
- Nur Kontrolle
- cat /etc/nsswitch.conf
passwd: files systemd sss group: files systemd sss shadow: files systemd sss gshadow: files systemd hosts: files dns networks: files protocols: db files services: db files sss ethers: db files rpc: db files netgroup: nis sss sudoers: files sss automount: sss
PAM
- pam-auth-update --enable sss mkhomedir