This commit is contained in:
mark committed 2026-09-03 22:11:57 +02:00
1 parent 682d8d571c
commit 1782a9bf47
5 files changed
+46

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
- name: Install fail2ban
apt:
name: [fail2ban, python3-systemd]
state: present
- name: Configure sshd jail
template:
src: fail2ban/sshd.local.j2
dest: /etc/fail2ban/jail.d/sshd.local
owner: root
group: root
mode: "0644"
notify: restart fail2ban
- name: Enable fail2ban
service:
name: fail2ban
state: started
enabled: true
+14
View File
@@ -0,0 +1,14 @@
[DEFAULT]
backend = systemd
banaction = nftables-multiport
banaction_allports = nftables-allports
ignoreip = {{ (['127.0.0.1/8', '::1'] + fail2ban_ignoreip | default([])) | join(' ') }}
bantime = {{ fail2ban_bantime | default('1h') }}
bantime.increment = true
bantime.maxtime = {{ fail2ban_bantime_max | default('1w') }}
findtime = {{ fail2ban_findtime | default('10m') }}
maxretry = {{ fail2ban_maxretry | default(5) }}
[sshd]
enabled = true
port = ssh