
App/Pakete installieren
Zuerst die Grundlagen installieren:
die Google AUthenticator App findet ihr hier, im Playstore. Diese bitte auf euren Smartphone installieren, falls ihr das noch nicht getan habt.
Jetzt zum Rechner:
Das Pam Google Authenticator Paket installierengast@TO:~$ sudo apt-get install libpam-google-authenticator
Bestätigen und auf die Installation warten.
Konfiguration
1. Am Rechner gast@TO:~$ google-authenticator
Dann erhaltet ihr folgende Meldungen, die ihr, wie ihr sie bracht mit y/n bestätigt. Dahinter immer meine Konfiguration....
Do you want authentication tokens to be time-based (y/n) y WICHTIG!
Do you want me to update your "~/.google_authenticator" file (y/n) y WICHTIG!
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) y
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, you can increase the window from its default
size of 1:30min to about 4min. Do you want to do so (y/n) y
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) y
Ihr erhaltet einen coolen QR-Code in der Konsole (muss mir mal angucken wie die das machen), ein Geheimnis und 5 Ersatzcodes.
Druckt euch am besten die Ersatzcodes irgendwo aus und bringt sie an einen sicheren Ort.
2. Am Smartphone
Den QR Code scannt ihr mit der google autheticator App ein, dass sollte meistens klappen, ansonsten müsst ihr das Geheimnis manuell eintragen.
Bitte erst danach folgende Änderung ausführen:
3. Am Rechner gast@TO:~$ sudo nano /etc/pam.d/common-auth
Und in dieser Textdatei fügt ihr dann VOR der Zeile auth [success=1 default=ignore] pam_unix.so nullok_secure folgende Zeile ein:auth required pam_google_authenticator.so
Speichern (Strg+O) und Schließen (Strg+X).
FERTIG!
Jetzt noch das ganze TESTEN! ;)
So sollte es aussehen.
gast@TO:~$ sudo nano
Verification code:
[sudo] Passwort für gast:
Viel Spaß! :)
Quellen
1 https://www.linux.com/learn/how-set-2-factor-authentication-login-and-sudo
2/Weiterführend https://www.digitalocean.com/community/tutorials/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-16-04
3/Weiterführend https://sysconfig.org.uk/two-factor-authentication-with-ssh.html