La guida è per sistemi CentOS 7, ma credo che non ci siano problemi su CentOS 8 o derivate Debian
installare i pacchetti:
yum install openldap-clients nss-pam-ldapd
Procedere con l'autoconfigurazione:
authconfig --enableldap \
--enableldapauth \
--ldapserver=test.local o indirizzo IP \
--ldapbasedn="dc=test,dc=local" \
--enablemkhomedir \
--update
Il comando "enablemkhomedir" farà in modo che all'accesso verrà creata la /home directory.
Creare su active directory un utente di servizio per l'integrazione e copiare il "distinguishedName"
Modificare il file /etc/nslcd.conf
# The distinguished name of the search base.
base dc=test,dc=local
# The distinguished name to bind to the server with.
# Optional: default is to bind anonymously.
binddn inserire il distinguishedName precedentemente copiato
binddn cn=ldaplinux,ou=Servizio,dc=test,dc=local
# The credentials to bind with.
# Optional: default is no credentials.
# Note that if you set a bindpw you should check the permissions of this file.
bindpw "inserire la password dell'account di servizio"
bindpw passwd
deccomentare tutta la parte riferita a Active Directory
# Mappings for Active Directorypagesize 1000
referrals off
idle_timelimit 800
filter passwd (&(objectClass=user)(!(objectClass=computer))(uidNumber=*)(unixHomeDirectory=*))
map passwd uid sAMAccountName
map passwd homeDirectory unixHomeDirectory
map passwd gecos displayName
filter shadow (&(objectClass=user)(!(objectClass=computer))(uidNumber=*)(unixHomeDirectory=*))
map shadow uid sAMAccountName
map shadow shadowLastChange pwdLastSet
filter group (objectClass=group)
Salvare e uscire
Riavviare il servizio:
#systemctl restart nslcd
A questo punto è necessario modificare gli attributi per l'account che dovrà autenticarsi.
Sulla macchina Linux verificare l'account modiificato su Active Directory
#id adm_ep_test
uid=5000(adm_ep_test) gid=100(users) gruppi=100(users)
Fare un test d'accesso:
#ssh adm_ep_test@localhost
adm_ep_test@localhost's password:
Creating directory '/home/adm_ep_test'.
Last login: Mon May 9 15:17:42 2022 from ::1