|
@@ -0,0 +1,25 @@
|
|
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
|
+ - libqrencode3
|
|
8
|
+ - libpam-dev
|
|
9
|
+ #- libpam-google-authenticator wasn't available in wheezy
|
|
10
|
+
|
|
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
|
|
13
|
+
|
|
14
|
+- 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
|
+
|
|
17
|
+- name: Install Google authenticator
|
|
18
|
+ command: make install chdir=/root/libpam-google-authenticator-{{ google_auth_version }} creates=/usr/local/bin/google-authenticator
|
|
19
|
+
|
|
20
|
+- name: Update sshd config to enable challenge responses
|
|
21
|
+ lineinfile: dest=/etc/ssh/sshd_config regexp=^ChallengeResponseAuthentication line="ChallengeResponseAuthentication yes" state=present
|
|
22
|
+ notify: restart ssh
|
|
23
|
+
|
|
24
|
+- name: Add Google authenticator to PAM
|
|
25
|
+ lineinfile: dest=/etc/pam.d/sshd line="auth required pam_google_authenticator.so" insertbefore=BOF state=present
|