fail2ban
This commit is contained in:
1 parent
682d8d571c
commit
1782a9bf47
5 files changed
+46
No files matched your search
@@ -27,3 +27,8 @@
|
||||
service:
|
||||
name: nginx
|
||||
state: reloaded
|
||||
|
||||
- name: restart fail2ban
|
||||
service:
|
||||
name: fail2ban
|
||||
state: restarted
|
||||
@@ -30,6 +30,9 @@ cloud_nginx_sites:
|
||||
port: 8087
|
||||
max_body: 2g # song uploads
|
||||
|
||||
fail2ban_ignoreip:
|
||||
- home.hoekveen.net
|
||||
|
||||
stroopwafel_dir: /opt/stroopwafel
|
||||
stroopwafel_repo: gitea@git.hoekveen.net:mark/stroopwafel.git
|
||||
stroopwafel_version: master
|
||||
|
||||
@@ -118,10 +118,17 @@
|
||||
mode: "0775"
|
||||
loop: [nextcloud, hdwiki, gitea, authentik, drone, "hoekveen.net"]
|
||||
- import_tasks: tasks/nextcloud.yml
|
||||
tags: nextcloud
|
||||
- import_tasks: tasks/hdwiki.yml
|
||||
tags: hdwiki
|
||||
- import_tasks: tasks/gitea.yml
|
||||
tags: gitea
|
||||
- import_tasks: tasks/nightingale.yml
|
||||
tags: nightingale
|
||||
- import_tasks: tasks/stroopwafel.yml
|
||||
tags: stroopwafel
|
||||
- import_tasks: tasks/fail2ban.yml
|
||||
tags: fail2ban
|
||||
- import_tasks: tasks/cloud_nginx.yml
|
||||
- name: Ensure the backup user can run the forced-command pull
|
||||
user:
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
Reference in new issue
Block a user