feat(host): добавить ключи root_home и раннера, отключить вход по паролю
This commit is contained in:
1 parent
5f91f7bc95
commit
0d19f80039
5 files changed
+49
-2
No files matched your search
@@ -30,10 +30,10 @@ jobs:
|
|||||||
|
|
||||||
if [ "$(id -u)" -eq 0 ]; then
|
if [ "$(id -u)" -eq 0 ]; then
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install -y git openssh-client ansible-core python3
|
apt-get install -y git openssh-client ansible-core python3 sshpass
|
||||||
else
|
else
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y git openssh-client ansible-core python3
|
sudo apt-get install -y git openssh-client ansible-core python3 sshpass
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -rf "${HOME}/homelab-infra"
|
rm -rf "${HOME}/homelab-infra"
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ 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:
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
host_authorized_keys:
|
||||||
|
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIF/yxhAs022l/8FlPlhyi7NeF3CvVGsev3B1HtKICO7M root_from_windows"
|
||||||
|
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICf80si9YG5lZkhRkVZUclrxu6hEGimWrAH/uib10rdi gitea@gitea"
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- name: Перезапустить SSH
|
||||||
|
ansible.builtin.service:
|
||||||
|
name: ssh
|
||||||
|
state: reloaded
|
||||||
@@ -6,6 +6,43 @@
|
|||||||
- name: Собрать факты
|
- name: Собрать факты
|
||||||
ansible.builtin.setup:
|
ansible.builtin.setup:
|
||||||
|
|
||||||
|
- name: Создать каталог .ssh
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /root/.ssh
|
||||||
|
state: directory
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "0700"
|
||||||
|
|
||||||
|
- name: Добавить авторизованные SSH-ключи
|
||||||
|
ansible.builtin.lineinfile:
|
||||||
|
path: /root/.ssh/authorized_keys
|
||||||
|
line: "{{ item }}"
|
||||||
|
state: present
|
||||||
|
create: true
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "0600"
|
||||||
|
loop: "{{ host_authorized_keys }}"
|
||||||
|
|
||||||
|
- name: Отключить вход по паролю в drop-in sshd_config.d
|
||||||
|
ansible.builtin.copy:
|
||||||
|
dest: /etc/ssh/sshd_config.d/99-disable-passwords.conf
|
||||||
|
content: |
|
||||||
|
PasswordAuthentication no
|
||||||
|
KbdInteractiveAuthentication no
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "0644"
|
||||||
|
notify: Перезапустить SSH
|
||||||
|
|
||||||
|
- name: Запретить PasswordAuthentication в основном sshd_config
|
||||||
|
ansible.builtin.lineinfile:
|
||||||
|
path: /etc/ssh/sshd_config
|
||||||
|
regexp: '^(#\s*)?PasswordAuthentication\s+.*'
|
||||||
|
line: 'PasswordAuthentication no'
|
||||||
|
notify: Перезапустить SSH
|
||||||
|
|
||||||
- name: Поставить Docker
|
- name: Поставить Docker
|
||||||
ansible.builtin.apt:
|
ansible.builtin.apt:
|
||||||
name:
|
name:
|
||||||
|
|||||||
Reference in new issue
Block a user