|
@@ -1,40 +0,0 @@
|
1
|
|
----
|
2
|
|
-# Defines tasks applicable for Google Authenticator.
|
3
|
|
-
|
4
|
|
-- name: Ensure required packages are installed
|
5
|
|
- apt: pkg={{ item }} state=present
|
6
|
|
- with_items:
|
7
|
|
- - libpam-google-authenticator
|
8
|
|
- - libpam0g-dev
|
9
|
|
- - libqrencode3
|
10
|
|
- tags:
|
11
|
|
- - dependencies
|
12
|
|
-
|
13
|
|
-- name: Update sshd config to enable challenge responses
|
14
|
|
- lineinfile: dest=/etc/ssh/sshd_config
|
15
|
|
- regexp=^ChallengeResponseAuthentication
|
16
|
|
- line="ChallengeResponseAuthentication yes"
|
17
|
|
- state=present
|
18
|
|
- notify: restart ssh
|
19
|
|
-
|
20
|
|
-- name: Add Google authenticator to PAM
|
21
|
|
- lineinfile: dest=/etc/pam.d/sshd
|
22
|
|
- line="auth required pam_google_authenticator.so"
|
23
|
|
- insertbefore=BOF
|
24
|
|
- state=present
|
25
|
|
-
|
26
|
|
-- name: Generate a timed-based, no reuse, rate-limited (3 logins per 30 seconds) with one concurrently valid code for default user
|
27
|
|
- command: /usr/bin/google-authenticator -t -f -d --label="{{ main_user_name }}@{{ domain }}" --qr-mode=ANSI -r 3 -R 30 -w 1 --secret=/home/{{ main_user_name }}/.google_authenticator
|
28
|
|
- creates=/home/{{ main_user_name }}/.google_authenticator
|
29
|
|
- become: yes
|
30
|
|
- become_user: "{{ main_user_name }}"
|
31
|
|
- when: ansible_ssh_user != "vagrant"
|
32
|
|
-
|
33
|
|
-- name: Retrieve generated keys from server
|
34
|
|
- fetch: src=/home/{{ main_user_name }}/.google_authenticator
|
35
|
|
- dest=/tmp/sovereign-google-auth-files
|
36
|
|
- when: ansible_ssh_user != "vagrant"
|
37
|
|
-
|
38
|
|
-- pause: seconds=5
|
39
|
|
- prompt="Your Google Authentication keys are in /tmp/sovereign-google-auth-files. Press any key to continue..."
|
40
|
|
- when: ansible_ssh_user != "vagrant"
|