|
63 | 63 | changed_when: false |
64 | 64 | check_mode: no |
65 | 65 |
|
| 66 | +<<<<<<< HEAD |
| 67 | +# Install the 2FA packages and setup the config in PAM and SSH |
| 68 | + |
| 69 | +- block: |
| 70 | + - name: Install google authenticator PAM module |
| 71 | + apt: name=libpam-google-authenticator state=installed |
| 72 | + when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' |
| 73 | + |
| 74 | + - name: Install google authenticator PAM module |
| 75 | + yum: name=google-authenticator state=installed |
| 76 | + when: ansible_os_family == 'RedHat' or ansible_os_family == 'Oracle Linux' |
| 77 | + |
| 78 | + - name: Add google auth module to PAM |
| 79 | + pamd: |
| 80 | + name: sshd |
| 81 | + type: auth |
| 82 | + control: required |
| 83 | + module_path: pam_google_authenticator.so |
| 84 | + |
| 85 | + - name: Remove password auth from PAM |
| 86 | + pamd: |
| 87 | + name: sshd |
| 88 | + type: auth |
| 89 | + control: substack |
| 90 | + module_path: password-auth |
| 91 | + state: absent |
| 92 | + when: ansible_distribution == 'RedHat' or ansible_distribution == 'Oracle Linux' |
| 93 | + |
| 94 | + - name: Remove password auth from PAM |
| 95 | + replace: |
| 96 | + dest: /etc/pam.d/sshd |
| 97 | + regexp: '^@include common-auth' |
| 98 | + replace: '#@include common-auth' |
| 99 | + when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' |
| 100 | + |
| 101 | + when: |
| 102 | + - ssh_use_pam |
| 103 | + - ssh_challengeresponseauthentication |
| 104 | + - ssh_google_auth |
| 105 | + |
| 106 | + |
66 | 107 | - block: # only runs when selinux is installed |
67 | 108 | - name: install selinux dependencies when selinux is installed on RHEL or Oracle Linux |
68 | 109 | package: name="{{item}}" state=installed |
|
84 | 125 | failed_when: false |
85 | 126 | changed_when: false |
86 | 127 | check_mode: no |
87 | | - |
88 | | - # The following tasks only get executed when selinux is in state permisive or enforcing, UsePam is "no" and the ssh_password module is installed. |
| 128 | + |
| 129 | + # The following tasks only get executed when selinux is in state enforcing, UsePam is "no" and the ssh_password module is installed. |
89 | 130 | # See this issue for more info: https://github.com/hardening-io/ansible-ssh-hardening/issues/23 |
90 | 131 | - block: |
91 | 132 | - name: Create selinux custom policy drop folder |
|
0 commit comments