fix(ssh): отключить пароли через 00-disable-passwords.conf, удалить временный пароль из hosts

This commit is contained in:
karpenok committed 2026-11-08 12:16:52 +07:00
1 parent 0d19f80039
commit fd8012ce63
4 files changed
+15 -2

No files matched your search

-1
View File
@@ -7,7 +7,6 @@ all:
rus-central: rus-central:
ansible_host: 45.154.185.208 ansible_host: 45.154.185.208
ansible_user: root ansible_user: root
ansible_password: "rJ1vC5cS5gxA"
netbird: netbird:
hosts: hosts:
rus-central: rus-central:
+1
View File
@@ -2,3 +2,4 @@
host_authorized_keys: host_authorized_keys:
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIF/yxhAs022l/8FlPlhyi7NeF3CvVGsev3B1HtKICO7M root_from_windows" - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIF/yxhAs022l/8FlPlhyi7NeF3CvVGsev3B1HtKICO7M root_from_windows"
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICf80si9YG5lZkhRkVZUclrxu6hEGimWrAH/uib10rdi gitea@gitea" - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICf80si9YG5lZkhRkVZUclrxu6hEGimWrAH/uib10rdi gitea@gitea"
+1
View File
@@ -3,3 +3,4 @@
ansible.builtin.service: ansible.builtin.service:
name: ssh name: ssh
state: reloaded state: reloaded
+13 -1
View File
@@ -25,9 +25,15 @@
mode: "0600" mode: "0600"
loop: "{{ host_authorized_keys }}" 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 - name: Отключить вход по паролю в drop-in sshd_config.d
ansible.builtin.copy: ansible.builtin.copy:
dest: /etc/ssh/sshd_config.d/99-disable-passwords.conf dest: /etc/ssh/sshd_config.d/00-disable-passwords.conf
content: | content: |
PasswordAuthentication no PasswordAuthentication no
KbdInteractiveAuthentication no KbdInteractiveAuthentication no
@@ -36,6 +42,12 @@
mode: "0644" mode: "0644"
notify: Перезапустить SSH 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 - name: Запретить PasswordAuthentication в основном sshd_config
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /etc/ssh/sshd_config path: /etc/ssh/sshd_config