linux:ssh_gauth
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
linux:ssh_gauth [2016/02/20 23:12] – gdureuil | linux:ssh_gauth [2020/07/24 22:03] (Version actuelle) – modification externe 127.0.0.1 | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
====== Sécuriser les connexions SSH avec Google Authenticator ====== | ====== Sécuriser les connexions SSH avec Google Authenticator ====== | ||
- | Testé sur Debian 8 | + | ===== Information ===== |
+ | |||
+ | <WRAP center info 100%> | ||
+ | Testé sur Debian 8. | ||
+ | </ | ||
===== Installation ===== | ===== Installation ===== | ||
- | Installer les packages | + | Installer les packages. |
- | | + | <sxh bash;> |
- | + | apt install libpam-google-authenticator | |
- | (Ici unzip sert à décompresser l' | + | </sxh> |
- | + | ||
- | Télécharger et décompresser les sources de libpam | + | |
- | + | ||
- | cd / | + | |
- | wget https:// | + | |
- | unzip googleauth.zip && rm googleauth.zip | + | |
- | cd google-authenticator-master/ | + | |
- | + | ||
- | Penser à adapter l'URL pour la dernière version et donc le nom du dossier qui est extrait | + | |
- | + | ||
- | Lancer la compilation | + | |
- | + | ||
- | ./bootstrap.sh | + | |
- | ./ | + | |
- | make | + | |
- | make install | + | |
===== Configuration ===== | ===== Configuration ===== | ||
Ligne 35: | Ligne 23: | ||
Saisir la commande | Saisir la commande | ||
- | | + | <sxh bash;> |
+ | google-authenticator | ||
+ | </ | ||
Cinq questions vont être posées, les réponses YES sont les plus sécurisées, | Cinq questions vont être posées, les réponses YES sont les plus sécurisées, | ||
- | | + | <sxh text;> |
+ | Do you want authentication tokens to be time-based (y/n) | ||
| | ||
- | | + | Yes |
+ | </ | ||
Vous obtenez une adresse de QRCode ou une clé de configuration pour Google Authenticator sur votre mobile. Gardez aussi en sécurité les 5 codes de secours. | Vous obtenez une adresse de QRCode ou une clé de configuration pour Google Authenticator sur votre mobile. Gardez aussi en sécurité les 5 codes de secours. | ||
- | | + | <sxh text;> |
+ | Do you want me to update your "/ | ||
| | ||
- | | + | Yes |
+ | </ | ||
Le fichier sera généré pour l' | Le fichier sera généré pour l' | ||
- | | + | <sxh text;> |
+ | Do you want to disallow multiple uses of the same authentication token? This restricts you to one login about every 30s, but it increases your chances to notice or even prevent man-in-the-middle attacks (y/n) | ||
| | ||
- | | + | Yes |
+ | </ | ||
- | | + | <sxh text;> |
+ | By default, tokens are good for 30 seconds and in order to compensate for possible time-skew between the client and the server, we allow an extra token before and after the current time. If you experience problems with poor time synchronization, | ||
| | ||
- | | + | Yes |
+ | </ | ||
- | | + | <sxh text;> |
+ | If the computer that you are logging into isn't hardened against brute-force login attempts, you can enable rate-limiting for the authentication module. By default, this limits attackers to no more than 3 login attempts every 30s. Do you want to enable rate-limiting (y/n) | ||
| | ||
- | | + | Yes |
+ | </ | ||
Un QR sera affiché, et/ou une clé secrète, pour configurer votre Google Authenticator. | Un QR sera affiché, et/ou une clé secrète, pour configurer votre Google Authenticator. | ||
Ligne 69: | Ligne 69: | ||
Editer le fichier de configuration PAM | Editer le fichier de configuration PAM | ||
- | | + | <sxh bash;> |
+ | nano / | ||
+ | </ | ||
Ajouter à la fin | Ajouter à la fin | ||
- | | + | <sxh text; Title: / |
+ | auth required pam_google_authenticator.so nullok | ||
+ | </ | ||
Le paramètre nullok permet à un compte utilisateur, | Le paramètre nullok permet à un compte utilisateur, | ||
Ligne 81: | Ligne 85: | ||
Editer le fichier suivant | Editer le fichier suivant | ||
- | | + | <sxh bash;> |
+ | nano / | ||
+ | </ | ||
- | Chercher | + | Chercher |
Redémarrer le service ssh | Redémarrer le service ssh | ||
- | | + | <sxh bash;> |
+ | / | ||
+ | </ | ||
===== Tester la connexion ===== | ===== Tester la connexion ===== | ||
- | Vérifier la configuration dans "/ | + | Vérifier la configuration dans '' |
Tester la connexion en SSH. | Tester la connexion en SSH. | ||
- | Si problème, vérifier | + | Si problème, vérifier |
+ | |||
+ | ===== Restreindre à une liste d' | ||
+ | |||
+ | On peut restreindre l' | ||
+ | |||
+ | <sxh bash;> | ||
+ | nano / | ||
+ | </ | ||
+ | |||
+ | Et ajouter : | ||
+ | <sxh text; Title: / | ||
+ | AllowUsers root mon_user_1 mon_user_2 | ||
+ | </ | ||
+ | |||
+ | ===== Sources ===== | ||
- | [[http://pirmax.fr/2014/02/13/securiser-les-connexions-ssh-avec-google-authenticator/|Source 1]] - [[http://www.linux.org/threads/ | + | [[https://github.com/google/google-authenticator|github.com/google/ |
linux/ssh_gauth.1456009943.txt.gz · Dernière modification : 2020/07/24 22:03 (modification externe)