add base for totp
This commit is contained in:
parent
af2f7d191a
commit
b6e22ff91d
2 changed files with 24 additions and 0 deletions
22
roles/base_totp/tasks/main.yml
Normal file
22
roles/base_totp/tasks/main.yml
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
---
|
||||||
|
- name: Install the PAM lib
|
||||||
|
apt:
|
||||||
|
name:
|
||||||
|
- libpam-oath
|
||||||
|
state: latest
|
||||||
|
update_cache: true
|
||||||
|
register: apt_result
|
||||||
|
retries: 3
|
||||||
|
until: apt_result is succeeded
|
||||||
|
|
||||||
|
- name: Add the totp secret for users
|
||||||
|
lineinfile:
|
||||||
|
path: /etc/users.oath
|
||||||
|
regexp: "{{ item.name }}"
|
||||||
|
line: "HOTP/T60/6 {{ item.name }} - {{item.totp}}"
|
||||||
|
create: true
|
||||||
|
group: root
|
||||||
|
owner: root
|
||||||
|
mode: '600'
|
||||||
|
loop: "{{ uservault_users }}"
|
||||||
|
no_log: true
|
|
@ -10,11 +10,13 @@ dependencies:
|
||||||
insertbefore: BOF
|
insertbefore: BOF
|
||||||
|
|
||||||
- name: Set ChallengeResponseAuthentication in sshd conf
|
- name: Set ChallengeResponseAuthentication in sshd conf
|
||||||
|
lineinfile:
|
||||||
path: /etc/ssh/sshd_config
|
path: /etc/ssh/sshd_config
|
||||||
regexp: '^#?ChallengeResponseAuthentication'
|
regexp: '^#?ChallengeResponseAuthentication'
|
||||||
line: 'ChallengeResponseAuthentication yes'
|
line: 'ChallengeResponseAuthentication yes'
|
||||||
|
|
||||||
- name: Set UsePAM in sshd conf
|
- name: Set UsePAM in sshd conf
|
||||||
|
lineinfile:
|
||||||
path: /etc/ssh/sshd_config
|
path: /etc/ssh/sshd_config
|
||||||
regexp: '^#?UsePAM'
|
regexp: '^#?UsePAM'
|
||||||
line: 'UsePAM yes'
|
line: 'UsePAM yes'
|
||||||
|
|
Loading…
Reference in a new issue