Différences
Ci-dessous, les différences entre deux révisions de la page.
| Prochaine révision | Révision précédente | ||
| utilisateurs:fr.laugier:brouillon [Le 19/11/2014, 22:53] – créée fr.laugier | utilisateurs:fr.laugier:brouillon [Le 11/09/2022, 13:15] (Version actuelle) – Suppression des espaces en fin de ligne (détecté et corrigé via le bot wiki-corrector (https://forum.ubuntu-fr.org/viewtopic.php?id=2067892) moths-art | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| - | {{tag>BROUILLON pam}} | + | {{tag>ldap}} |
| ---- | ---- | ||
| Ligne 8: | Ligne 8: | ||
| Cette page est pour n' | Cette page est pour n' | ||
| - | |||
| - | L' | ||
| ===== Introduction ===== | ===== Introduction ===== | ||
| Ligne 19: | Ligne 17: | ||
| sudo apt-get install libpam-ldap nscd</ | sudo apt-get install libpam-ldap nscd</ | ||
| l' | l' | ||
| - | * ldap server Uniform Resource Identifier : | + | * ldap server Uniform Resource Identifier : |
| indiquer l' | indiquer l' | ||
| < | < | ||
| Ligne 33: | Ligne 31: | ||
| * Make local root Database admin : | * Make local root Database admin : | ||
| YES | YES | ||
| - | * Does the LDAP database require login? | + | * Does the LDAP database require login? |
| No | No | ||
| * LDAP account for root: | * LDAP account for root: | ||
| Ligne 45: | Ligne 43: | ||
| ===== Configuration des logiciels ===== | ===== Configuration des logiciels ===== | ||
| - | TODO | + | Il faut maintenant faire quelques modifications dans les fichiers de conf concernant l' |
| - | We have to adjust a few files to tell our authentication files that they can look to our LDAP server for authentication information. | + | |
| - | First, edit the / | + | Tout d'abord, éditez le fichier |
| - | + | < | |
| - | sudo nano / | + | |
| - | + | ||
| - | The three lines we are interested in are the " | + | |
| - | + | ||
| - | passwd: | + | |
| - | group: | + | |
| - | shadow: | + | |
| - | + | ||
| - | Next, we will add a value to our PAM configuration. | + | |
| - | + | ||
| - | PAM, or Pluggable Authentication Modules, is a system that connects applications that can provide authentication to applications that require authentication. | + | |
| - | + | ||
| - | PAM is already implemented on most computers, and works behind the scenes without needing user interaction. When we installed and configured our LDAP PAM module, most of the needed information was added to the configuration files. | + | |
| - | + | ||
| - | Edit the /etc/pam.d/ | + | |
| - | + | ||
| - | sudo nano / | + | |
| - | + | ||
| - | Add a line to the bottom of the configuration that reads: | + | |
| - | + | ||
| - | session required | + | |
| - | + | ||
| - | This will create a home directory on the client machine when an LDAP user logs in who does not have a home directory. | + | |
| - | + | ||
| - | We have to restart a service for these changes to be implemented: | + | |
| - | + | ||
| - | sudo / | + | |
| - | + | ||
| - | Permissions | + | |
| - | + | ||
| - | During the LDAP server configuration, | + | |
| - | + | ||
| - | The LDAP users that you added to the " | + | |
| - | + | ||
| - | This is because we have a line that gives members of the " | + | |
| - | + | ||
| - | sudo visudo | + | |
| - | + | ||
| - | There is a line that reads: | + | |
| - | + | ||
| - | %admin ALL=(ALL) ALL | + | |
| - | + | ||
| - | Entries that begin with a percentage sign (%) specify a group instead of a user. If you wish to disable this functionality, | + | |
| - | + | ||
| - | #%admin ALL=(ALL) ALL | + | |
| - | + | ||
| - | Log In as an LDAP User | + | |
| - | + | ||
| - | We have now configured our client machine enough to be able to log in as one of our LDAP users. This user does not have to exist on the client machine. | + | |
| - | + | ||
| - | In a new terminal window (it is best to keep your original terminal window logged in, in case of a configuration mistake), ssh into the client machine using an LDAP user's credentials: | + | |
| - | + | ||
| - | ssh LDAP_user@LDAP_client_IP_Address | + | |
| - | + | ||
| - | You should be able to log in as if your user had been created locally. Issue the print working directory command: | + | |
| - | + | ||
| - | pwd | + | |
| - | + | ||
| - | You should see that the home directory you selected for your user on the LDAP server is being used on this machine. It has been created on-demand to serve the LDAP user. | + | |
| - | + | ||
| - | If you log out and log in with a different LDAP user, you can see that there will be two home directory entries: | + | |
| - | + | ||
| - | ls /home | + | |
| - | + | ||
| - | user1 user2 | + | |
| - | + | ||
| - | If your user is part of the " | + | |
| - | + | ||
| - | If you issue the passwd command to change your password, you can see that it will be modifying your LDAP credentials: | + | |
| - | + | ||
| - | passwd | + | |
| - | + | ||
| - | Enter login(LDAP) password: | + | |
| - | + | ||
| - | Restricting Access by Group | + | |
| - | + | ||
| - | If you only want members of certain groups to be able to log into this specific machine, you can configure that restriction within the PAM files. | + | |
| - | + | ||
| - | Edit the following file with root privileges: | + | |
| - | + | ||
| - | sudo nano /etc/pam.d/ | + | |
| - | + | ||
| - | At the bottom, we will specify that PAM should look at the security access file to see how to restrict user logins. Add this to the bottom: | + | |
| - | + | ||
| - | auth required | + | |
| - | + | ||
| - | Save and close the file. | + | |
| - | + | ||
| - | The file that PAM references for security information when that setting is configured is at / | + | |
| - | + | ||
| - | sudo nano /etc/security/ | + | |
| - | + | ||
| - | We need to add a rule to the end of the file. | + | |
| - | + | ||
| - | The dash (-) at the beginning of the line means this is a restriction. From the first colon (:) to the next colon, we specify who this rule applies to. | + | |
| - | + | ||
| - | We specify that this applies to all users except root and the group " | + | |
| - | + | ||
| - | From the second colon to the end of the line, we will specify under which circumstances the rule should apply. In our case, the restriction will apply in all circumstances but local logins. | + | |
| - | + | ||
| - | -:ALL EXCEPT root (admin):ALL EXCEPT LOCAL | + | |
| - | + | ||
| - | This will allow us to restrict logins to the " | + | |
| - | + | ||
| - | This will also allow us to log in through the " | + | |
| - | + | ||
| - | Keep in mind that this will apply to all users, not just LDAP users. So any users you create on the client machine will need to be a member of one of the specified groups. | + | |
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | ===== Note pour Gutsy ===== | + | |
| - | + | ||
| - | Il y a un nouvel outil dans Gutsy pour modifier les outils de pam et de nsswitch en même temps : | + | |
| - | sudo auth-client-config -a -p lac_ldap | + | |
| - | + | ||
| - | ===== L’installation et la configuration de LDAP ===== | + | |
| - | + | ||
| - | ==== La configuration de nsswitch.conf | + | |
| - | + | ||
| - | Malheureusement nous ne pouvons tester la configuration des paquets plus haut sans la modification de | + | |
| - | + | ||
| - | sudo vi / | + | |
| - | + | ||
| - | et remplacer **compat** par **ldap files** ou par cette commande dans vi : | + | |
| - | + | ||
| - | : | + | |
| - | + | ||
| - | Votre fichier / | + | |
| + | Modifiez les 3 lignes passwd, group et shadow en ajoutant ldap à la fin de la ligne : | ||
| < | < | ||
| - | passwd: | + | passwd : files ldap |
| - | group: | + | group : files ldap |
| - | shadow: | + | shadow : files ldap |
| </ | </ | ||
| + | <note tip> | ||
| - | Pensez | + | Attaquons nous maintenant |
| - | + | Editez | |
| - | / | + | < |
| - | ou | + | Allez à la fin du ficher et ajoutez cette ligne : |
| - | + | <code>session required | |
| - | service nscd restart | + | Cela permet de créer |
| - | + | Cette configuration | |
| - | ===== Tester | + | < |
| - | + | ||
| - | Maintenant vous pouvez tester la configuration avec | + | |
| - | + | ||
| - | + | ||
| - | les commandes plus bas (remplacer **< | + | |
| - | + | ||
| - | getent passwd < | + | |
| - | getent group < | + | |
| - | + | ||
| - | Si vous avez une réponse dans les deux cas **nsswitch.conf** est correctement configuré la seule chose qui reste à faire est | + | |
| - | de configurer PAM. | + | |
| - | + | ||
| - | Il est aussi possible de taper directement : getent passwd vous devez alors voir tous les utilisateurs de votre serveur ldap. Si ce n'est pas le cas, éditez et vérifiez | + | |
| - | < | + | |
| - | </ | + | |
| - | + | ||
| - | <note important>Sans réponses, quels sont les points à vérifier pour trouver l' | + | |
| - | < | + | |
| - | + | ||
| - | + | ||
| ===== Configuration de PAM ===== | ===== Configuration de PAM ===== | ||
| Ligne 297: | Ligne 146: | ||
| session required | session required | ||
| session optional | session optional | ||
| + | </ | ||
| + | Il faut maintenant redémarrer le service nscd pour prendre en compte les modifications : | ||
| + | < | ||
| + | Vous pouvez vérifier que votre machine interroge bien la base LDAP en tapant la commande | ||
| + | < | ||
| + | qui listera l' | ||
| - | ===== Notes ===== | + | ===== Permissions |
| + | Il est judicieux d' | ||
| - | * Je ne peux promettre que ce document soit sans erreur mais je l'ai testé et il fonctionne. | + | Pour éditer |
| + | Cherchez la ligne : | ||
| + | < | ||
| + | Si elle est commentée (commence par un #), ce groupe sera sans effet sur votre système. | ||
| + | Si elle n'est pas commentée, un user LDAP appartenant au groupe admin pour prendre les droits root ! | ||
| - | ===== Alternative ===== | + | ===== Se connecter en tant qu'utilisateur |
| - | ==== Installation d'un client | + | |
| - | Je me permets d' | + | |
| - | Tout d'abord pour installer le client sur une ubuntu/mint 14.04, j'ai suivi ce tuto pour activer | + | Votre machine est maintenant capable |
| + | Pour le tester, vous pouvez tenter d'ouvrir une session SSH sur cette machine. Par exemple | ||
| + | < | ||
| + | Si l' | ||
| - | === Online Mode (Serveur LDAP Accessible) === | + | Si cela ne fonctionne pas, reprenez chacune des étapes pas à pas. |
| - | Pour configurer le client ldap sur ma distrib ubuntu, j'ai suivi ce tuto qui a fonctionné comme un charme : | + | |
| - | https:// | + | ===== Permettre l' |
| - | + | Et oui, les laptop ayant la facheuse tendance à être utilisés aussi en mode déconnecté, | |
| - | et pour la conf de mes laptop, j'ai ajouté ceci | + | |
| === Offline mode (Serveur LDAP inaccessible - Laptop itinérants) === | === Offline mode (Serveur LDAP inaccessible - Laptop itinérants) === | ||
| + | Commençons par installer le necessaire : | ||
| < | < | ||
| sudo apt-get install nss-updatedb libnss-db libpam-ccreds nslcd | sudo apt-get install nss-updatedb libnss-db libpam-ccreds nslcd | ||
| Ligne 327: | Ligne 187: | ||
| group: | group: | ||
| </ | </ | ||
| - | ensuite éditer etc/ | + | ensuite éditer etc/ |
| < | < | ||
| - | account [success=1 default=ignore] pam_ldap.so | + | account [success=1 default=ignore] pam_ldap.so |
| </ | </ | ||
| par | par | ||
| Ligne 341: | Ligne 201: | ||
| ===== Crédits ===== | ===== Crédits ===== | ||
| + | https:// | ||
| - | Source : traduction de https:// | ||
| - | |||
| - | * La plupart des informations viennent de cette page : | ||
| - | http:// | ||
| - | * Des informations additionnelles peuvent être trouvées ici : | ||
| - | * http:// | ||
| - | * http:// | ||
| - | |||
| - | ---- | ||
| - | // | + | // |
