Set-OPS — moteur d'ecosystemes numeriques souverains (Alliance Boreale)
This commit is contained in:
commit
3dd3f43ad8
308 changed files with 13649 additions and 0 deletions
3
roles/fail2ban_ssh/README.md
Normal file
3
roles/fail2ban_ssh/README.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# Rôle fail2ban_ssh
|
||||
|
||||
Configure fail2ban pour SSH.
|
||||
6
roles/fail2ban_ssh/defaults/main.yml
Normal file
6
roles/fail2ban_ssh/defaults/main.yml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
fail2ban_ssh_enabled: true
|
||||
fail2ban_ssh_bantime: "1h"
|
||||
fail2ban_ssh_findtime: "10m"
|
||||
fail2ban_ssh_maxretry: 5
|
||||
fail2ban_ssh_port: 22
|
||||
5
roles/fail2ban_ssh/handlers/main.yml
Normal file
5
roles/fail2ban_ssh/handlers/main.yml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
- name: Restart fail2ban
|
||||
ansible.builtin.systemd:
|
||||
name: fail2ban
|
||||
state: restarted
|
||||
29
roles/fail2ban_ssh/tasks/main.yml
Normal file
29
roles/fail2ban_ssh/tasks/main.yml
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
- name: Installer fail2ban
|
||||
ansible.builtin.apt:
|
||||
name: fail2ban
|
||||
state: present
|
||||
|
||||
- name: Créer le répertoire jail.d
|
||||
ansible.builtin.file:
|
||||
path: /etc/fail2ban/jail.d
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0755"
|
||||
|
||||
- name: Déployer la jail SSH Set-OPS
|
||||
ansible.builtin.template:
|
||||
src: sshd-setops.local.j2
|
||||
dest: /etc/fail2ban/jail.d/sshd-setops.local
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
notify: Restart fail2ban
|
||||
|
||||
- name: Activer fail2ban
|
||||
ansible.builtin.systemd:
|
||||
name: fail2ban
|
||||
enabled: true
|
||||
state: started
|
||||
when: fail2ban_ssh_enabled | bool
|
||||
9
roles/fail2ban_ssh/templates/sshd-setops.local.j2
Normal file
9
roles/fail2ban_ssh/templates/sshd-setops.local.j2
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# Managed by Ansible — Set-OPS
|
||||
|
||||
[sshd]
|
||||
enabled = {{ 'true' if fail2ban_ssh_enabled | bool else 'false' }}
|
||||
port = {{ fail2ban_ssh_port }}
|
||||
backend = systemd
|
||||
maxretry = {{ fail2ban_ssh_maxretry }}
|
||||
findtime = {{ fail2ban_ssh_findtime }}
|
||||
bantime = {{ fail2ban_ssh_bantime }}
|
||||
Loading…
Reference in a new issue