backup_base: Add sftp ssh config when needed
This commit is contained in:
parent
e233860b7b
commit
788c9fa453
1 changed files with 22 additions and 0 deletions
|
@ -30,3 +30,25 @@
|
||||||
owner: root
|
owner: root
|
||||||
group: "{{ ansible_wheel }}"
|
group: "{{ ansible_wheel }}"
|
||||||
follow: false
|
follow: false
|
||||||
|
|
||||||
|
- name: Create authorized_keys
|
||||||
|
ansible.builtin.copy:
|
||||||
|
dest: /etc/ssh/authorized_keys.backup
|
||||||
|
src: ../files/ssh/backup.pub
|
||||||
|
mode: "0640"
|
||||||
|
owner: root
|
||||||
|
group: backup
|
||||||
|
when: "'sftpbackup' in group_names"
|
||||||
|
|
||||||
|
- name: Configure sshd chroot
|
||||||
|
ansible.builtin.blockinfile:
|
||||||
|
path: /etc/ssh/sshd_config
|
||||||
|
block: |
|
||||||
|
Match User backup
|
||||||
|
ChrootDirectory /srv/backup
|
||||||
|
ForceCommand internal-sftp
|
||||||
|
AuthorizedKeysFile /etc/ssh/authorized_keys.backup
|
||||||
|
marker: "# {mark} ANSIBLE MANAGED BLOCK (user backup)"
|
||||||
|
validate: "sshd -t -f %s"
|
||||||
|
when: "'sftpbackup' in group_names"
|
||||||
|
notify: Restart sshd
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue