mirror of
https://git.local.zernis.ch/simon/homeserver.zernis.ch.git
synced 2025-12-15 21:09:40 +01:00
23 lines
626 B
YAML
23 lines
626 B
YAML
---
|
|
- name: Add Authorized Keys
|
|
ansible.posix.authorized_key:
|
|
user: "{{ system_user_name }}"
|
|
state: present
|
|
key: "{{ lookup('file', 'key.pub') }}"
|
|
|
|
- name: Harden SSH Config
|
|
ansible.builtin.lineinfile:
|
|
path: /etc/ssh/sshd_config
|
|
regexp: "{{ item.regexp }}"
|
|
line: "{{ item.line }}"
|
|
state: present
|
|
validate: 'sshd -T -f %s'
|
|
mode: '0644'
|
|
with_items:
|
|
- regexp: "^PasswordAuthentication"
|
|
line: "PasswordAuthentication no"
|
|
- regexp: "^Port"
|
|
line: "Port {{ ssh_port }}"
|
|
- regexp: "^PermitRootLogin"
|
|
line: "PermitRootLogin without-password"
|
|
notify: Restart ssh |