Setup fail2ban for gitea
This commit is contained in:
parent
9616ab751b
commit
cf327ca2d0
3 changed files with 32 additions and 1 deletions
5
roles/gitea-fail2ban/files/gitea-filter.conf
Normal file
5
roles/gitea-fail2ban/files/gitea-filter.conf
Normal file
|
@ -0,0 +1,5 @@
|
|||
# Fail2ban gitea filter
|
||||
|
||||
[Definition]
|
||||
failregex = .*(Failed authentication attempt|invalid credentials|Attempted access of unknown user).* from <HOST>
|
||||
ignoreregex =
|
8
roles/gitea-fail2ban/files/gitea-jail.conf
Normal file
8
roles/gitea-fail2ban/files/gitea-jail.conf
Normal file
|
@ -0,0 +1,8 @@
|
|||
[gitea]
|
||||
enabled = true
|
||||
filter = gitea
|
||||
logpath = /var/lib/gitea/log/gitea.log
|
||||
maxretry = 10
|
||||
findtime = 3600
|
||||
bantime = 900
|
||||
action = iptables-allports
|
|
@ -1,2 +1,20 @@
|
|||
---
|
||||
# TODO: https://docs.gitea.io/en-us/fail2ban-setup/
|
||||
- name: Copy fail2ban filter
|
||||
become: true
|
||||
copy:
|
||||
src: gitea-filter.conf
|
||||
dest: /etc/fail2ban/filter.d/gitea.conf
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
notify: Restart fail2ban service
|
||||
|
||||
- name: Copy fail2ban jail
|
||||
become: true
|
||||
copy:
|
||||
src: gitea-jail.conf
|
||||
dest: /etc/fail2ban/jail.d/gitea.conf
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
notify: Restart fail2ban service
|
||||
|
|
Loading…
Reference in a new issue