|
@@ -9,17 +9,41 @@
|
9
|
9
|
#- libpam-google-authenticator wasn't available in wheezy
|
10
|
10
|
|
11
|
11
|
- name: Download Google authenticator pam module
|
12
|
|
- get_url: url=https://google-authenticator.googlecode.com/files/libpam-google-authenticator-{{ google_auth_version }}-source.tar.bz2 dest=/root/libpam-google-authenticator-{{ google_auth_version }}-source.tar.bz2
|
|
12
|
+ get_url: url=https://google-authenticator.googlecode.com/files/libpam-google-authenticator-{{ google_auth_version }}-source.tar.bz2
|
|
13
|
+ dest=/root/libpam-google-authenticator-{{ google_auth_version }}-source.tar.bz2
|
13
|
14
|
|
14
|
15
|
- name: Extract Google authenticator
|
15
|
|
- command: tar xjf libpam-google-authenticator-{{ google_auth_version }}-source.tar.bz2 chdir=/root creates=/root/libpam-google-authenticator-{{ google_auth_version }}
|
|
16
|
+ command: tar xjf libpam-google-authenticator-{{ google_auth_version }}-source.tar.bz2
|
|
17
|
+ chdir=/root creates=/root/libpam-google-authenticator-{{ google_auth_version }}
|
16
|
18
|
|
17
|
19
|
- name: Install Google authenticator
|
18
|
|
- command: make install chdir=/root/libpam-google-authenticator-{{ google_auth_version }} creates=/usr/local/bin/google-authenticator
|
|
20
|
+ command: make install
|
|
21
|
+ chdir=/root/libpam-google-authenticator-{{ google_auth_version }}
|
|
22
|
+ creates=/usr/local/bin/google-authenticator
|
19
|
23
|
|
20
|
24
|
- name: Update sshd config to enable challenge responses
|
21
|
|
- lineinfile: dest=/etc/ssh/sshd_config regexp=^ChallengeResponseAuthentication line="ChallengeResponseAuthentication yes" state=present
|
|
25
|
+ lineinfile: dest=/etc/ssh/sshd_config
|
|
26
|
+ regexp=^ChallengeResponseAuthentication
|
|
27
|
+ line="ChallengeResponseAuthentication yes"
|
|
28
|
+ state=present
|
22
|
29
|
notify: restart ssh
|
23
|
30
|
|
24
|
31
|
- name: Add Google authenticator to PAM
|
25
|
|
- lineinfile: dest=/etc/pam.d/sshd line="auth required pam_google_authenticator.so" insertbefore=BOF state=present
|
|
32
|
+ lineinfile: dest=/etc/pam.d/sshd
|
|
33
|
+ line="auth required pam_google_authenticator.so"
|
|
34
|
+ insertbefore=BOF
|
|
35
|
+ state=present
|
|
36
|
+
|
|
37
|
+- name: Generate QNR code for default user
|
|
38
|
+ command: /usr/local/bin/google-authenticator -t -f -d --label="{{ main_user_name }}@{{ domain }}" --qr-mode=ANSI -r 3 -R 30 -W --secret=/home/{{ main_user_name }}/.google_authenticator
|
|
39
|
+ creates=/home/{{ main_user_name }}/.google_authenticator
|
|
40
|
+
|
|
41
|
+- name: Fix permissions on generated file
|
|
42
|
+ file: state=file path=/home/{{ main_user_name }}/.google_authenticator owner={{ main_user_name }} group={{ main_user_name }}
|
|
43
|
+
|
|
44
|
+- name: Retrieve generated keys from server
|
|
45
|
+ fetch: src=/home/{{ main_user_name }}/.google_authenticator
|
|
46
|
+ dest=/tmp/sovereign-google-auth-files
|
|
47
|
+
|
|
48
|
+- pause: seconds=5
|
|
49
|
+ prompt="Your Google Authentication keys are in /tmp/sovereign-google-auth-files. Press any key to continue..."
|