fix(ssh): отключить пароли через 00-disable-passwords.conf, удалить временный пароль из hosts
This commit is contained in:
1 parent
0d19f80039
commit
fd8012ce63
4 files changed
+15
-2
No files matched your search
@@ -25,9 +25,15 @@
|
||||
mode: "0600"
|
||||
loop: "{{ host_authorized_keys }}"
|
||||
|
||||
- name: Удалить cloud-init настройки пароля SSH
|
||||
ansible.builtin.file:
|
||||
path: /etc/ssh/sshd_config.d/50-cloud-init.conf
|
||||
state: absent
|
||||
notify: Перезапустить SSH
|
||||
|
||||
- name: Отключить вход по паролю в drop-in sshd_config.d
|
||||
ansible.builtin.copy:
|
||||
dest: /etc/ssh/sshd_config.d/99-disable-passwords.conf
|
||||
dest: /etc/ssh/sshd_config.d/00-disable-passwords.conf
|
||||
content: |
|
||||
PasswordAuthentication no
|
||||
KbdInteractiveAuthentication no
|
||||
@@ -36,6 +42,12 @@
|
||||
mode: "0644"
|
||||
notify: Перезапустить SSH
|
||||
|
||||
- name: Удалить устаревший drop-in sshd_config.d
|
||||
ansible.builtin.file:
|
||||
path: /etc/ssh/sshd_config.d/99-disable-passwords.conf
|
||||
state: absent
|
||||
notify: Перезапустить SSH
|
||||
|
||||
- name: Запретить PasswordAuthentication в основном sshd_config
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/ssh/sshd_config
|
||||
|
||||
Reference in new issue
Block a user