v1.0.0
This commit is contained in:
23
playbooks/playbook_ssh.yml
Normal file
23
playbooks/playbook_ssh.yml
Normal file
@@ -0,0 +1,23 @@
|
||||
---
|
||||
- name: Konfiguracja SSH (blokada pustych haseł)
|
||||
hosts: all
|
||||
gather_facts: true
|
||||
|
||||
tasks:
|
||||
- name: Zablokuj logowanie na puste hasła (PermitEmptyPasswords no)
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/ssh/sshd_config
|
||||
# Szuka linii zaczynającej się od PermitEmptyPasswords (również zakomentowanej)
|
||||
regexp: '(?i)^\s*#?\s*PermitEmptyPasswords'
|
||||
line: 'PermitEmptyPasswords no'
|
||||
state: present
|
||||
backup: yes
|
||||
# Sprawdza poprawność pliku przed zapisem, aby nie zepsuć SSH
|
||||
validate: '/usr/sbin/sshd -t -f %s'
|
||||
notify: Restart SSH
|
||||
|
||||
handlers:
|
||||
- name: Restart SSH
|
||||
ansible.builtin.service:
|
||||
name: ssh
|
||||
state: restarted
|
||||
Reference in New Issue
Block a user