fix: ssh authorized_keys fallback
This commit is contained in:
parent
e1a1518cb8
commit
2c6da106b2
@ -53,6 +53,14 @@
|
|||||||
- name: Backup authorized_keys out of HOME dir (if unavailable at startup)
|
- name: Backup authorized_keys out of HOME dir (if unavailable at startup)
|
||||||
command: "cp /home/{{ item }}/.ssh/authorized_keys {{ssh_authorized_keys_fallback_dir}}/{{ item }}"
|
command: "cp /home/{{ item }}/.ssh/authorized_keys {{ssh_authorized_keys_fallback_dir}}/{{ item }}"
|
||||||
loop: "{{ ssh_users.split() }}"
|
loop: "{{ ssh_users.split() }}"
|
||||||
|
|
||||||
|
- name: Fix ownership
|
||||||
|
file:
|
||||||
|
path: "{{ssh_authorized_keys_fallback_dir}}/{{ item }}"
|
||||||
|
owner: "{{ item }}"
|
||||||
|
group: "{{ item }}"
|
||||||
|
mode: "0600"
|
||||||
|
loop: "{{ ssh_users.split() }}"
|
||||||
when: ssh_authorized_keys_fallback_enabled
|
when: ssh_authorized_keys_fallback_enabled
|
||||||
|
|
||||||
- name: Create an SSH banner
|
- name: Create an SSH banner
|
||||||
|
|||||||
@ -19,6 +19,11 @@ ChallengeResponseAuthentication no
|
|||||||
KerberosAuthentication no
|
KerberosAuthentication no
|
||||||
GSSAPIAuthentication no
|
GSSAPIAuthentication no
|
||||||
UsePAM yes
|
UsePAM yes
|
||||||
|
{% if ssh_authorized_keys_fallback_enabled %}
|
||||||
|
AuthorizedKeysFile .ssh/authorized_keys /etc/ssh/authorized_keys/%u
|
||||||
|
{% else %}
|
||||||
|
AuthorizedKeysFile .ssh/authorized_keys
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
# Login timeout and grace period
|
# Login timeout and grace period
|
||||||
LoginGraceTime 30s
|
LoginGraceTime 30s
|
||||||
@ -62,9 +67,3 @@ Compression no
|
|||||||
{% if ansible_distribution == 'Ubuntu' or ansible_distribution == 'Debian' %}
|
{% if ansible_distribution == 'Ubuntu' or ansible_distribution == 'Debian' %}
|
||||||
UsePrivilegeSeparation sandbox
|
UsePrivilegeSeparation sandbox
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if ssh_authorized_keys_fallback_enabled %}
|
|
||||||
AuthorizedKeysFile .ssh/authorized_keys /etc/ssh/authorized_keys/%u
|
|
||||||
{% else %}
|
|
||||||
AuthorizedKeysFile .ssh/authorized_keys
|
|
||||||
{% endif %}
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user