created fail2ban state #2
6
fail2ban/files/filter.d/nextcloud.local
Normal file
6
fail2ban/files/filter.d/nextcloud.local
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
[Definition]
|
||||||
|
_groupsre = (?:(?:,?\s*"\w+":(?:"[^"]+"|\w+))*)
|
||||||
|
failregex = ^\{%(_groupsre)s,?\s*"remoteAddr":"<HOST>"%(_groupsre)s,?\s*"message":"Login failed:
|
||||||
|
^\{%(_groupsre)s,?\s*"remoteAddr":"<HOST>"%(_groupsre)s,?\s*"message":"Trusted domain error.
|
||||||
|
datepattern = ,?\s*"time"\s*:\s*"%%Y-%%m-%%d[T ]%%H:%%M:%%S(%%z)?"
|
||||||
|
|
@ -1,3 +1,4 @@
|
|||||||
|
# SSH
|
||||||
configure sshd jail:
|
configure sshd jail:
|
||||||
file.managed:
|
file.managed:
|
||||||
- name: /etc/fail2ban/jail.d/sshd.local
|
- name: /etc/fail2ban/jail.d/sshd.local
|
||||||
@ -8,10 +9,30 @@ configure sshd jail:
|
|||||||
- onlyif:
|
- onlyif:
|
||||||
- pkg.is_installed: openssh
|
- pkg.is_installed: openssh
|
||||||
|
|
||||||
|
# Nextcloud
|
||||||
|
configure nextcloud jail:
|
||||||
|
file.managed:
|
||||||
|
- name: /etc/fail2ban/jail.d/nextcloud.local
|
||||||
|
- source: salt://fail2ban/files/jail.d/nextcloud.local
|
||||||
|
- user: root
|
||||||
|
- group: root
|
||||||
|
- mode: "0644"
|
||||||
|
- onlyif: runuser -l {{ salt['pillar.get']('podman:user', 'root') }} -c 'podman container exists gitea'
|
||||||
|
|
||||||
|
configure nextcloud filter:
|
||||||
|
file.managed:
|
||||||
|
- name: /etc/fail2ban/filter.d/nextcloud.local
|
||||||
|
- source: salt://fail2ban/files/filter.d/nextcloud.local
|
||||||
|
- user: root
|
||||||
|
- group: root
|
||||||
|
- mode: "0644"
|
||||||
|
- onlyif: runuser -l {{ salt['pillar.get']('podman:user', 'root') }} -c 'podman container exists gitea'
|
||||||
|
|
||||||
|
######
|
||||||
realod fail2ban config:
|
realod fail2ban config:
|
||||||
cmd.run:
|
cmd.run:
|
||||||
- name: fail2ban-client reload
|
- name: fail2ban-client reload
|
||||||
- onchanges:
|
- onchanges:
|
||||||
- file: configure sshd jail
|
- file: configure sshd jail
|
||||||
|
- file: configure nextcloud jail
|
||||||
|
- file: configure nextcloud filter
|
||||||
|
Reference in New Issue
Block a user