No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

google_auth.yml 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. ---
  2. # Defines tasks applicable for Google Authenticator
  3. - name: Ensure required packages are installed
  4. apt: pkg={{ item }} state=present
  5. with_items:
  6. - libqrencode3
  7. - libpam-dev
  8. #- libpam-google-authenticator wasn't available in wheezy
  9. - name: Download Google authenticator pam module
  10. get_url: url=https://google-authenticator.googlecode.com/files/libpam-google-authenticator-{{ google_auth_version }}-source.tar.bz2
  11. dest=/root/libpam-google-authenticator-{{ google_auth_version }}-source.tar.bz2
  12. - name: Extract Google authenticator
  13. command: tar xjf libpam-google-authenticator-{{ google_auth_version }}-source.tar.bz2
  14. chdir=/root creates=/root/libpam-google-authenticator-{{ google_auth_version }}
  15. - name: Install Google authenticator
  16. command: make install
  17. chdir=/root/libpam-google-authenticator-{{ google_auth_version }}
  18. creates=/usr/local/bin/google-authenticator
  19. - name: Update sshd config to enable challenge responses
  20. lineinfile: dest=/etc/ssh/sshd_config
  21. regexp=^ChallengeResponseAuthentication
  22. line="ChallengeResponseAuthentication yes"
  23. state=present
  24. notify: restart ssh
  25. - name: Add Google authenticator to PAM
  26. lineinfile: dest=/etc/pam.d/sshd
  27. line="auth required pam_google_authenticator.so"
  28. insertbefore=BOF
  29. state=present
  30. - name: Generate a timed-based, no reuse, rate-limited (3 logins per 30 seconds) with no concurrently valid codes for default user
  31. command: /usr/local/bin/google-authenticator -t -f -d --label="{{ main_user_name }}@{{ domain }}" --qr-mode=NONE -r 3 -R 30 -W --secret=/home/{{ main_user_name }}/.google_authenticator
  32. creates=/home/{{ main_user_name }}/.google_authenticator
  33. - name: Fix permissions on generated file
  34. file: state=file path=/home/{{ main_user_name }}/.google_authenticator owner={{ main_user_name }} group={{ main_user_name }}
  35. - name: Retrieve generated keys from server
  36. fetch: src=/home/{{ main_user_name }}/.google_authenticator
  37. dest=/tmp/sovereign-google-auth-files
  38. - pause: seconds=5
  39. prompt="Your Google Authentication keys are in /tmp/sovereign-google-auth-files. Press any key to continue..."